Login failed for user ''. The user is not associated with a trusted SQL Server connection.

Collapse
This topic is closed.
X
X
 
  • Time
  • Show
Clear All
new posts
  • eruth

    Login failed for user ''. The user is not associated with a trusted SQL Server connection.

    There are loads of post on this, but nothing that seems to cover my
    exact problem ;)

    I have an ASP.Net 1.1 web application running on my local machine. I
    want to connect to an SQL 2005 server running on Windows 2003.

    If I use SQL authentication, all is fine and dandy. If I want to use
    windows authentication it gives the above error. My SQL server is set
    to allow both methods (first thing I checked) and is part of the
    domain (2nd thing checked).

    If I create a UDL file on the local machine and connect to the SQL
    server with that, it reports that the test connection is successful,
    so I took the connection string from that and used it in my
    web.config, but got the above error.

    Here's my connection string using SQL Authentication

    "Password=RagUs er;Persist Security Info=True;User ID=RagUser;Init ial
    Catalog=KBDL_Co nfig;Data Source=UKBOLDEV 01"

    and the connection string using windows authentication

    "Integrated Security=SSPI;P ersist Security Info=False;Init ial
    Catalog=KBDL_Co nfig;Data Source=ukboldev 01"

    Even adding 'Trusted Connection=True ' to the windows authentication
    doesn't help!

    SQL 2005 has errors in it's log, it shows.

    10/26/2007 16:35:54,Logon, Unknown,Login failed for user ''. The user
    is not associated with a trusted SQL Server connection. [CLIENT:
    192.168.41.75]
    10/26/2007 16:35:54,Logon, Unknown,Error: 18452<c/Severity: 14<c/>
    State: 1.
    10/26/2007 16:35:54,Logon, Unknown,SSPI handshake failed with error
    code 0x8009030c while establishing a connection with integrated
    security; the connection has been closed. [CLIENT: 192.168.41.75]
    10/26/2007 16:35:54,Logon, Unknown,Error: 17806<c/Severity: 20<c/>
    State: 2.


    I'm baffled by this, I've even tried connecting to the server using
    oSQL, that was successful, but with vb.net from a web app, it fails.
    There's a code snippet below

    <code>
    strSQL = "SELECT * FROM LOGINS WHERE Username='" & strUsername & "'
    AND Password='" & strPassword & "'"

    myconnection = New
    SqlConnection(C onfigurationSet tings.AppSettin gs("ConfigCon") ) 'get
    from web.config
    myCommand = New SqlCommand(strS QL, myconnection)

    Try
    If (myCommand.Conn ection.State <ConnectionStat e.Open)
    Then 'check connection state
    myCommand.Conne ction.Open() ' open connection if
    needed
    End If
    </code>

  • Patrice

    #2
    Re: Login failed for user ''. The user is not associated with a trusted SQL Server connection.

    Have you tried also something such as :



    --
    Patrice

    "eruth" <emma.pearlman@ gmail.coma écrit dans le message de news:
    1193413628.1809 10.3670@k79g200 0h...legrou ps.com...
    There are loads of post on this, but nothing that seems to cover my
    exact problem ;)
    >
    I have an ASP.Net 1.1 web application running on my local machine. I
    want to connect to an SQL 2005 server running on Windows 2003.
    >
    If I use SQL authentication, all is fine and dandy. If I want to use
    windows authentication it gives the above error. My SQL server is set
    to allow both methods (first thing I checked) and is part of the
    domain (2nd thing checked).
    >
    If I create a UDL file on the local machine and connect to the SQL
    server with that, it reports that the test connection is successful,
    so I took the connection string from that and used it in my
    web.config, but got the above error.
    >
    Here's my connection string using SQL Authentication
    >
    "Password=RagUs er;Persist Security Info=True;User ID=RagUser;Init ial
    Catalog=KBDL_Co nfig;Data Source=UKBOLDEV 01"
    >
    and the connection string using windows authentication
    >
    "Integrated Security=SSPI;P ersist Security Info=False;Init ial
    Catalog=KBDL_Co nfig;Data Source=ukboldev 01"
    >
    Even adding 'Trusted Connection=True ' to the windows authentication
    doesn't help!
    >
    SQL 2005 has errors in it's log, it shows.
    >
    10/26/2007 16:35:54,Logon, Unknown,Login failed for user ''. The user
    is not associated with a trusted SQL Server connection. [CLIENT:
    192.168.41.75]
    10/26/2007 16:35:54,Logon, Unknown,Error: 18452<c/Severity: 14<c/>
    State: 1.
    10/26/2007 16:35:54,Logon, Unknown,SSPI handshake failed with error
    code 0x8009030c while establishing a connection with integrated
    security; the connection has been closed. [CLIENT: 192.168.41.75]
    10/26/2007 16:35:54,Logon, Unknown,Error: 17806<c/Severity: 20<c/>
    State: 2.
    >
    >
    I'm baffled by this, I've even tried connecting to the server using
    oSQL, that was successful, but with vb.net from a web app, it fails.
    There's a code snippet below
    >
    <code>
    strSQL = "SELECT * FROM LOGINS WHERE Username='" & strUsername & "'
    AND Password='" & strPassword & "'"
    >
    myconnection = New
    SqlConnection(C onfigurationSet tings.AppSettin gs("ConfigCon") ) 'get
    from web.config
    myCommand = New SqlCommand(strS QL, myconnection)
    >
    Try
    If (myCommand.Conn ection.State <ConnectionStat e.Open)
    Then 'check connection state
    myCommand.Conne ction.Open() ' open connection if
    needed
    End If
    </code>
    >

    Comment

    • bruce barker

      #3
      Re: Login failed for user ''. The user is not associated with a trustedSQL Server connection.

      if your local asp.net site is running under iis, then you need to set to
      run under a domain account with access the sqlserver.

      1) if you only hit the website locally just set impersonate=tru e in the
      web config and require authenication to ntlm in iis

      2) if your local box is vista or server2003 set the app pool for the
      asp.net site to the desired domain account.

      3) if none of above, in web.config set impersonate with a useName and
      password.

      -- bruce (sqlwork.com)

      eruth wrote:
      There are loads of post on this, but nothing that seems to cover my
      exact problem ;)
      >
      I have an ASP.Net 1.1 web application running on my local machine. I
      want to connect to an SQL 2005 server running on Windows 2003.
      >
      If I use SQL authentication, all is fine and dandy. If I want to use
      windows authentication it gives the above error. My SQL server is set
      to allow both methods (first thing I checked) and is part of the
      domain (2nd thing checked).
      >
      If I create a UDL file on the local machine and connect to the SQL
      server with that, it reports that the test connection is successful,
      so I took the connection string from that and used it in my
      web.config, but got the above error.
      >
      Here's my connection string using SQL Authentication
      >
      "Password=RagUs er;Persist Security Info=True;User ID=RagUser;Init ial
      Catalog=KBDL_Co nfig;Data Source=UKBOLDEV 01"
      >
      and the connection string using windows authentication
      >
      "Integrated Security=SSPI;P ersist Security Info=False;Init ial
      Catalog=KBDL_Co nfig;Data Source=ukboldev 01"
      >
      Even adding 'Trusted Connection=True ' to the windows authentication
      doesn't help!
      >
      SQL 2005 has errors in it's log, it shows.
      >
      10/26/2007 16:35:54,Logon, Unknown,Login failed for user ''. The user
      is not associated with a trusted SQL Server connection. [CLIENT:
      192.168.41.75]
      10/26/2007 16:35:54,Logon, Unknown,Error: 18452<c/Severity: 14<c/>
      State: 1.
      10/26/2007 16:35:54,Logon, Unknown,SSPI handshake failed with error
      code 0x8009030c while establishing a connection with integrated
      security; the connection has been closed. [CLIENT: 192.168.41.75]
      10/26/2007 16:35:54,Logon, Unknown,Error: 17806<c/Severity: 20<c/>
      State: 2.
      >
      >
      I'm baffled by this, I've even tried connecting to the server using
      oSQL, that was successful, but with vb.net from a web app, it fails.
      There's a code snippet below
      >
      <code>
      strSQL = "SELECT * FROM LOGINS WHERE Username='" & strUsername & "'
      AND Password='" & strPassword & "'"
      >
      myconnection = New
      SqlConnection(C onfigurationSet tings.AppSettin gs("ConfigCon") ) 'get
      from web.config
      myCommand = New SqlCommand(strS QL, myconnection)
      >
      Try
      If (myCommand.Conn ection.State <ConnectionStat e.Open)
      Then 'check connection state
      myCommand.Conne ction.Open() ' open connection if
      needed
      End If
      </code>
      >

      Comment

      • eruth

        #4
        Re: Login failed for user ''. The user is not associated with a trusted SQL Server connection.

        Bruce,

        To address your suggestions.

        1) The problem with this solution is that once this site is deployed,
        the webserver will be in the DMZ, and the SQL server on the inside of
        the firewall.
        2) May be possible when deployed as the live servers will both be
        2003, however my development box (local pc) is XPsp2
        3) I'll try this and let you know.


        On 26 Oct, 17:29, bruce barker <nos...@nospam. comwrote:
        if your local asp.net site is running under iis, then you need to set to
        run under a domain account with access the sqlserver.
        >
        1) if you only hit the website locally just set impersonate=tru e in the
        web config and require authenication to ntlm in iis
        >
        2) if your local box is vista or server2003 set the app pool for the
        asp.net site to the desired domain account.
        >
        3) if none of above, in web.config set impersonate with a useName and
        password.
        >
        -- bruce (sqlwork.com)
        >
        eruth wrote:
        There are loads of post on this, but nothing that seems to cover my
        exact problem ;)
        >
        I have an ASP.Net 1.1 web application running on my local machine. I
        want to connect to an SQL 2005 server running on Windows 2003.
        >
        If I use SQL authentication, all is fine and dandy. If I want to use
        windows authentication it gives the above error. My SQL server is set
        to allow both methods (first thing I checked) and is part of the
        domain (2nd thing checked).
        >
        If I create a UDL file on the local machine and connect to the SQL
        server with that, it reports that the test connection is successful,
        so I took the connection string from that and used it in my
        web.config, but got the above error.
        >
        Here's my connection string using SQL Authentication
        >
        "Password=RagUs er;Persist Security Info=True;User ID=RagUser;Init ial
        Catalog=KBDL_Co nfig;Data Source=UKBOLDEV 01"
        >
        and the connection string using windows authentication
        >
        "Integrated Security=SSPI;P ersist Security Info=False;Init ial
        Catalog=KBDL_Co nfig;Data Source=ukboldev 01"
        >
        Even adding 'Trusted Connection=True ' to the windows authentication
        doesn't help!
        >
        SQL 2005 has errors in it's log, it shows.
        >
        10/26/2007 16:35:54,Logon, Unknown,Login failed for user ''. The user
        is not associated with a trusted SQL Server connection. [CLIENT:
        192.168.41.75]
        10/26/2007 16:35:54,Logon, Unknown,Error: 18452<c/Severity: 14<c/>
        State: 1.
        10/26/2007 16:35:54,Logon, Unknown,SSPI handshake failed with error
        code 0x8009030c while establishing a connection with integrated
        security; the connection has been closed. [CLIENT: 192.168.41.75]
        10/26/2007 16:35:54,Logon, Unknown,Error: 17806<c/Severity: 20<c/>
        State: 2.
        >
        I'm baffled by this, I've even tried connecting to the server using
        oSQL, that was successful, but with vb.net from a web app, it fails.
        There's a code snippet below
        >
        <code>
        strSQL = "SELECT * FROM LOGINS WHERE Username='" & strUsername & "'
        AND Password='" & strPassword & "'"
        >
        myconnection = New
        SqlConnection(C onfigurationSet tings.AppSettin gs("ConfigCon") ) 'get
        from web.config
        myCommand = New SqlCommand(strS QL, myconnection)
        >
        Try
        If (myCommand.Conn ection.State <ConnectionStat e.Open)
        Then 'check connection state
        myCommand.Conne ction.Open() ' open connection if
        needed
        End If
        </code>

        Comment

        • eruth

          #5
          Re: Login failed for user ''. The user is not associated with a trusted SQL Server connection.

          One final note - yes suggestion 3 did work, but on talking to the nice
          security people here, I was advised that using windows authentication
          might not be a good idea. So I'm going to stick with the SQL
          authentication and write a series of SQL jobs that will make sure the
          right users with the right permissions exist at the right time for my
          web pages to connect to the database.

          On 29 Oct, 09:15, eruth <emma.pearl...@ gmail.comwrote:
          Bruce,
          >
          To address your suggestions.
          >
          1) The problem with this solution is that once this site is deployed,
          the webserver will be in the DMZ, and theSQLserveron the inside of
          the firewall.
          2) May be possible when deployed as the live servers will both be
          2003, however my development box (local pc) is XPsp2
          3) I'll try this and let you know.
          >
          On 26 Oct, 17:29, bruce barker <nos...@nospam. comwrote:
          >
          if your local asp.net site is running under iis, then you need to set to
          run under a domain account with access the sqlserver.
          >
          1) if you only hit the website locally just set impersonate=tru e in the
          web config and require authenication to ntlm in iis
          >
          2) if your local box is vista or server2003 set the app pool for the
          asp.net site to the desired domain account.
          >
          3) if none of above, in web.config set impersonate with a useName and
          password.
          >
          -- bruce (sqlwork.com)
          >
          eruth wrote:
          There are loads of post on this, but nothing that seems to cover my
          exact problem ;)
          >
          I have an ASP.Net 1.1 web application running on my local machine. I
          want to connect to anSQL2005server running on Windows 2003.
          >
          If I useSQLauthentic ation, all is fine and dandy. If I want to use
          windows authentication it gives the above error. MySQLserveris set
          to allow both methods (first thing I checked) and is part of the
          domain (2nd thing checked).
          >
          If I create a UDL file on the local machine and connect to theSQL
          >serverwith that, it reports that the testconnectioni s successful,
          so I took theconnectionst ring from that and used it in my
          web.config, but got the above error.
          >
          Here's myconnectionstr ing usingSQLAuthent ication
          >
          "Password=RagUs er;Persist Security Info=True;UserI D=RagUser;Initi al
          Catalog=KBDL_Co nfig;Data Source=UKBOLDEV 01"
          >
          and theconnectionst ring using windows authentication
          >
          "Integrated Security=SSPI;P ersist Security Info=False;Init ial
          Catalog=KBDL_Co nfig;Data Source=ukboldev 01"
          >
          Even adding 'TrustedConnect ion=True' to the windows authentication
          doesn't help!
          >
          >SQL2005 has errors in it's log, it shows.
          >
          10/26/2007 16:35:54,Logon, Unknown,Loginfa iledforuser''. Theuser
          isnotassociated with atrustedSQLServ erconnection. [CLIENT:
          192.168.41.75]
          10/26/2007 16:35:54,Logon, Unknown,Error: 18452<c/Severity: 14<c/>
          State: 1.
          10/26/2007 16:35:54,Logon, Unknown,SSPI handshakefailed with error
          code 0x8009030c while establishing aconnectionwith integrated
          security; theconnectionha s been closed. [CLIENT: 192.168.41.75]
          10/26/2007 16:35:54,Logon, Unknown,Error: 17806<c/Severity: 20<c/>
          State: 2.
          >
          I'm baffled by this, I've even tried connecting to theserverusing
          oSQL, that was successful, but with vb.net from a web app, it fails.
          There's a code snippet below
          >
          <code>
          strSQL = "SELECT * FROM LOGINS WHERE Username='" & strUsername & "'
          AND Password='" & strPassword & "'"
          >
          myconnection = New
          SqlConnection(C onfigurationSet tings.AppSettin gs("ConfigCon") ) 'get
          from web.config
          myCommand = New SqlCommand(strS QL, myconnection)
          >
          Try
          If (myCommand.Conn ection.State <ConnectionStat e.Open)
          Then 'checkconnectio nstate
          myCommand.Conne ction.Open() ' openconnectioni f
          needed
          End If
          </code>

          Comment

          Working...