Showing posts with label website. Show all posts
Showing posts with label website. Show all posts

Sunday, 11 March 2012

Connect IIS to sql server 2005 db

I have developed a website that connected to sql2000 db

Now that I have upgraded to SQLserver2005, I always get the follwing message after launching the website:

Microsoft VBScript compilation error '800a0401'

Expected end of statement

/iisHelp/common/500-100.asp, line 11 Dim objASPError, blnErrorWritten, strServername, strServerIP, strRemoteIP Dim strMethod, lngPos, datNow, strQueryString, strURL --^

Microsoft OLE DB Provider for ODBC Drivers error '80004005'

[Microsoft][Gestionnaire de pilotes ODBC] Source de donnes introuvable et nom de pilote non spcifi

/FMCQ_Web/Include/Modules/modADO.asp, line 18

I have tried different things (security access, DSN, etc...)but seems that nothing is working,

Can someone out there suggest a move to get this going..

The error is so obvious:

Dim objASPError, blnErrorWritten, strServername, strServerIP, strRemoteIP Dim strMethod, lngPos, datNow, strQueryString, strURL

Change to two lines:

Dim objASPError, blnErrorWritten, strServername, strServerIP, strRemoteIP

Dim strMethod, lngPos, datNow, strQueryString, strURL

Hope this helps!
Joe

Wednesday, 7 March 2012

Confusing Cross-Database Permissions Issue

We're trying to follow the principle of least privilege here in setting up a user account for our website to use to access SQL Server 2005, but we're having a nightmarish time getting it to work.

The issue seems to be trying to get a limited access user account the ability to cross databases.

Here's the situation:

We have a User [WebUser] that we want to grant access to the database. This account has a login [WebUser] that has username=WebUser and password=ALongPassword.

This user only calls stored procedures in the database [WebData].

However, some of the stored procedures in [WebData] call stored procedures in the database [dbutil].

One of the stored procedures in [dbutil] inserts records into a table in a third database [dbutil_temp].[DebugLog].

This all works out great from my development account using Windows Authentication.

But as you might guess, if I do something like "EXECUTE AS [WebUser]" and run the same procedure on [WebData] things fall apart quickly. I've looked online regarding cross-database ownership chaining, but quite frankly, the whole users/logins/roles/schemas security model is confusing, and I'm getting nowhere fast on my own.

We really only want [WebUser] to have CONNECT and EXECUTE permissions on the primary [WebData] database, but it seems like we've got to do a lot more than that to get this to work.

I'd appreciate any help...

Yes, you have to do a bit more work, but it isn't a whole lot more work. The most appropriate solution for this is to use signatures for the cross database access. There are detailed demos for creating signatures as well as specifically signatures for cross database queries in the following blogs, which I VERY highly recommend reading.

http://blogs.msdn.com/lcris/

http://blogs.msdn.com/raulga/

I would also suggest listenting to the security presentations at http://cmcgc.com/media/WMP/261115

|||Thanks Mike, I'll take a look at those resources.

Friday, 10 February 2012

Configure SQL Server 2005 to allow remote connections!

Hello there,

I just deployed a new ASP.NET 2.0 website on a remote serverhttp://www.alrazem.com/. and when i want to log on, or when any connection to the database happens!! the following error ocurs.

Server Error in '/' Application.

An error has occurred while establishing a connection to the server. When connecting to SQL Server 2005, this failure may be caused by the fact that under the default settings SQL Server does not allow remote connections. (provider: SQL Network Interfaces, error: 26 - Error Locating Server/Instance Specified)

Description:An unhandled exception occurred during the execution of the current web request. Please review the stack trace for more information about the error and where it originated in the code.

Exception Details:System.Data.SqlClient.SqlException: An error has occurred while establishing a connection to the server. When connecting to SQL Server 2005, this failure may be caused by the fact that under the default settings SQL Server does not allow remote connections. (provider: SQL Network Interfaces, error: 26 - Error Locating Server/Instance Specified)

Anyways, I searched the new. and i found this link:http://support.microsoft.com/default.aspx?scid=kb;EN-US;914277... I followed the instructions and changed theSurface Area Configuration for Services and Connectionsto Local and remote connections.and Applied both protocols. Then redeployed the application. but the error still ocurs.

I didn't restart my machine after changing the SQL to remote. but i did the website from scratch again. and created a new connectionstring and database!!!

Any help? Thanks!

Hi singlenipple,

It seems that the after enabling the remote connection, you still cannot connect to it.

In this case I suggest you try the following steps.

1. Restart the computer and make sure that your SQL Server service is started.
2. Check if there is any firewall app running on this machine that prevents your service from being accessed.
3. Create a .txt file on a remote client machine, rename it to .udl, and double click on it. You will see a connection property dialog then. You can use this wizard to test the connection.