Login failed for user 'NT AUTHORITY\ANONYMOUS LOGON'

Discussion in 'ASP .Net' started by Srinivas Chintakindi, Nov 10, 2006.

  1. 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
     
    Srinivas Chintakindi, Nov 10, 2006
    #1
    1. Advertising

  2. Srinivas Chintakindi

    Jay Pondy Guest

    To 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 Windows
    2000 feature lets the client connect to multiple servers and pass the
    authentication credentials of the original client to each of the servers. You
    can use the Active Directory Users and Computers administration tool to check
    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" <>
    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
    >
     
    Jay Pondy, Nov 30, 2006
    #2
    1. Advertising

Want to reply to this thread or ask your own question?

It takes just 2 minutes to sign up (and it's free!). Just click the sign up button to choose a username and then you can ask your own questions on the forum.
Similar Threads
  1. =?Utf-8?B?QnVnZ3ltYW4=?=

    Login failed for user 'NT AUTHORITY\ANONYMOUS LOGON

    =?Utf-8?B?QnVnZ3ltYW4=?=, Jun 24, 2005, in forum: ASP .Net
    Replies:
    5
    Views:
    47,729
    sangsharma
    Dec 31, 2007
  2. Sorcerdon
    Replies:
    2
    Views:
    3,142
    Norman Yuan
    Jul 5, 2006
  3. Jay Pondy
    Replies:
    0
    Views:
    734
    Jay Pondy
    Nov 30, 2006
  4. YMichurin
    Replies:
    0
    Views:
    529
    YMichurin
    Oct 18, 2007
  5. dtd00
    Replies:
    3
    Views:
    933
    Paul Shapiro
    Sep 6, 2009
Loading...

Share This Page