Doing webforms in ASP.NET and i have a connection string in the webconfig that connects to a locally created SQL Server user account.
This is fine however when i try to connect to a domain account created by the IT administrator for me, it wont work.
The User name and password he supplied are correct as i logged into my PC (Win 2000) using it to test it. However when i try to connect to this remote network domain account by changing my connection string it fails... anyone any ideas, or am i missing a subtlety of ASP.NET and SQL connectionstrings?
Heres the connection string that works...
ConnectionString = value="Server=MY-SERVER;Network Library=DBMSSOCN;Initial Catalog=MYDATABASE2;User ID=MrLocalUser;Password=password;"
Heres the connection string that fails...
ConnectionString = value="Server=MY-SERVER;Network Library=DBMSSOCN;Initial Catalog=MYDATABASE2;User ID=DOMAIN\MrDomainUser;Password=password;"
??I'm not convinved that you can connect to a Sql Server using a windows account without using integrated security. Basically there are two type of authentication for SQL Server, "SQL Server" where you pass a username and password & "Window Integrated" where it passes the identity that the application is running. A connection string for this would be something like this:
ConectionString = "Server=MY-SERVER;Network Library=DBMSSOCN;Initial Catalog=MYDATABASE2;Integrated Security=SSPI"
So if you are running your ASP.NET application under the default user, the credentials passed would be:
[localmachine]\ASPNET
If you want to get it connect to the database using that specific account, you have a couple of options.
1) Change the identity that the asp.net application runs under. You can do this in the web.config file (i.e. to allow you to specify the specific user that the application runs under)
2) Switch on Impersonation, and have it run under the identity of the person logged into the application.
These both start to get a bit more involved, as it means you will need to ensure that the user that the process is running under has the appropriate permissions throughout the application, and also within the Framework folders.
Here's some info on Impersonation:
http://msdn.microsoft.com/library/default.asp?url=/library/en-us/cpguide/html/cpconaspnetimpersonation.asp
Here's some further reading on changig the Asp.Net identity:
http://msdn.microsoft.com/library/default.asp?url=/library/en-us/vsent7/html/vxconApplicationIdentity.asp
Hope this helps
Regards
Darren
MCSD.net