Saturday, March 24, 2012

Login failed for user 'NT AUTHORITY\ANONYMOUS LOGON'

Hi All,
I am developing one ASP.NET 2.0 application in which user test the remote
sql server existance. User enters remote sql server name, data base name,
authentication mode, user name, password. I am making the connection string
based on the authentication mode. If it is integrated authentication my
connection string would be as below.
try
{
string s = txtserver.Text;
string d = txtdatabase.Text;
System.Data.SqlClient.SqlConnection conn = new
System.Data.SqlClient.SqlConnection();
string constr = "Data Source=" + s + ";Initial Catalog=" + d +
";Integrated Security=SSPI";
conn.ConnectionString = constr;
conn.Open();
if (conn.State == ConnectionState.Open)
{
Response.Write("success");
}
conn.Close();
}
catch (Exception ex)
{
Response.Write(ex.Message + "<br>");
}
This code is working fine if the portal is accessed using
http://localhost/... but it is failing when the portal is accessed using
http://host_name/... and tries to test the remote sql server connection. I
enabled impersonation also in web.config file as below
<authentication mode="Windows"/>
<identity impersonate="true"/>
When user is accessing the portal from remote machine http://host_name/ and
trying to test the remote sql server the above code is failing and giving
the error as Login failed for user 'NT AUTHORITY\ANONYMOUS LOGON'. My web
site is configured to use Integrated windows authentication. I searched the
web for this problem but nothing is worked for me. I am surprising why the
requested user credentials are not passing
Please help me to solve this problem as this very important for me.
Thanks in advance.
Srinivas ChTo do this with Windows 2000 machines you must have Kerberos security set up
.
You are doing a double-hop.
You need to enable security account delegation on the IIS machine. This Wind
ows
2000 feature lets the client connect to multiple servers and pass the
authentication credentials of the original client to each of the servers. Yo
u
can use the Active Directory Users and Computers administration tool to chec
k
the Computer is trusted for delegation.
Plenty of links out there about how to do it.
On Fri, 10 Nov 2006 17:00:02 +0530, "Srinivas Chintakindi" <chsvas@.aim.com>
wrote:

>Hi All,
>I am developing one ASP.NET 2.0 application in which user test the remote
>sql server existance. User enters remote sql server name, data base name,
>authentication mode, user name, password. I am making the connection string
>based on the authentication mode. If it is integrated authentication my
>connection string would be as below.
>try
>{
> string s = txtserver.Text;
> string d = txtdatabase.Text;
> System.Data.SqlClient.SqlConnection conn = new
>System.Data.SqlClient.SqlConnection();
> string constr = "Data Source=" + s + ";Initial Catalog=" + d +
>";Integrated Security=SSPI";
> conn.ConnectionString = constr;
> conn.Open();
> if (conn.State == ConnectionState.Open)
> {
> Response.Write("success");
> }
> conn.Close();
>}
>catch (Exception ex)
>{
> Response.Write(ex.Message + "<br>");
>}
>This code is working fine if the portal is accessed using
>http://localhost/... but it is failing when the portal is accessed using
>http://host_name/... and tries to test the remote sql server connection. I
>enabled impersonation also in web.config file as below
><authentication mode="Windows"/>
><identity impersonate="true"/>
>When user is accessing the portal from remote machine http://host_name/ and
>trying to test the remote sql server the above code is failing and giving
>the error as Login failed for user 'NT AUTHORITY\ANONYMOUS LOGON'. My web
>site is configured to use Integrated windows authentication. I searched the
>web for this problem but nothing is worked for me. I am surprising why the
>requested user credentials are not passing
>Please help me to solve this problem as this very important for me.
>Thanks in advance.
>Srinivas Ch
>

0 comments:

Post a Comment