Wednesday, March 7, 2012

Login SQL Server using Integrated Security ! Problem

ok thi is my code for test

SqlConnection conn = new SqlConnection("server=majed13;Integrated Security=SSPI;");
conn.Open();
conn.Close();

connection isOK
the user logged in SQL Server isASPNET USER
i want looged in currentNT USER not ASPNET USER
thanx in advanceIt get the current user, you can use impersonation, and disable anonymous access to the Web. Is this on an Intranet? Do all users have rights to SQL Server? Is there a domain in place?|||Is this on an Intranet?Yes
Do all users have rights to SQL Server?Yes
Is there a domain in place?Yes


the problem in current user it's take the ASPNET not NT USER why ??
|||aspnet is the default iis user. Your best bet is to utilize ASP.NET's impersonation abilities in the web.config.

http://msdn.microsoft.com/library/en-us/vsent7/html/vxconImpersonation.asp?frame=true

that should explain a lot of it for you.

Either that, or utilize a DAL or stop using Integrated Security. :)|||the answer is


<identity impersonate="true" />

thank you

No comments:

Post a Comment