Sunday, March 11, 2012

Connection to SQL Server database

I keep on getting an error when I try to connect to my database throuh my ASP.NET WEb application. The error says login failed for user...

Initially I was using Windows Authentication with Impersonation turned on. This let me connect to the database no problem.

However, I decided to change my method of connecting to the database for performance reasons but now I get this error.

I store my connection string in web.config and it looks like this:


<appSettings>
<add key="ConnectionString" value="server=server;
Database=dbname;Connect Timeout=15;Network Library=dbmssocn;uid=username;password=userpassword"/>
</appSettings>

Further down in the web.config file I still have this:


<authentication mode="Windows" /
<authorization>
<allow users="nameofusergroup" />
<deny users="?" />
</authorization
<identity impersonate="true" />

Any ideas why I would be able to connect to the database using impersonation and not when I explicity give the crudentials in the connection string?

Regards

Wallaceprobably SQL Server isn't configured for SQL Authentication. just windows.

No comments:

Post a Comment