Interview Question in SQL Server Data Services (SSDS)


 

Interview Question :: Asp.net - connection to sql server problem


hi
conString = " Data Source=myservername;"+ "Initial Catalog=databasename;" + "Integrated Security=True;";

my sql server is configured for windows authentication only. no sql authentication.

when i debug my application i am getting an error
Login failed for user 'NT AUTHORITY\NETWORK SERVICE'.

i have used the following command in my query analyzer.

exec sp_grantlogin 'NT AUTHORITY\NETWORK SERVICE'
as i found in some asp.net forums.

but still i am getting the same error. i have sql server developer edition installed. and there is sql server express edition that comes with visual studio 2005.

when i am trying to connect to the database from my web application, using the Connect to database wizard it is giving only sql express server in the list.

Please help me.

thankx
Answers to "Asp.net - connection to sql server problem"
RE: Asp.net - connection to sql server problem?

Your asp.net app is trying to access SQL Server using integrated security.

Since ASP.NET runs under a local non-priveleged account, it cannot do it.



In web config, in the Identity tag, set the Impersonate attribute to True,

and turn on Windows Authenticated security. Then your users will access SQL

as themselves.

If you want every access to use the same windows account, then set the

Impersonate attribute to True and provide credentials in the attributes of

the Identity tag.

(the slightly more secure way to do this is to use aspnet_setreg.)



Some links that may help:

http://support.microsoft.com/kb/306158/E...



http://www.eggheadcafe.com/articles/2002...



http://www.microsoft.com/resources/...ti...



http://support.microsoft.com/kb/316989
 
Vote for this answer ::  
Update Alert Setting