Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • Home
  • SEARCH
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 514015
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 13, 20262026-05-13T07:28:51+00:00 2026-05-13T07:28:51+00:00

I can not seem to get sql server to recognize my credentials. Asp.net recognizes

  • 0

I can not seem to get sql server to recognize my credentials.

Asp.net recognizes me when I login but when I execute a sql command I get a login failed message.

The IIS server and SQL server are on different machines.

There are other applications the IIS server which are able to authenticate to the sql server. I believe the Active Directory settings are correct. I am investigating what I am doing differently.

I must be missing something.

  • I check the IIS settings
  • The web config is set to impersonate.

Below is the relevant information. If anyone has any idea as to what I missed or am doing wrong I would appreciate some help.

IIS Settings:

  • ‘Integrated Windows authentication’ is checked
  • ‘Enable anonymous access” is not checked

Web Config

<authentication mode="Windows"/>
<identity impersonate="true"/>
<authorization>
   <deny users="?" />   
</authorization>

Page_Load Code:

Dim winId As IIdentity = HttpContext.Current.User.Identity
TextBoxMessage.Text = winId.Name + Environment.NewLine
Dim cnn As SqlClient.SqlConnection

Try
   Dim sql As String = "*****"

   cnn = New SqlClient.SqlConnection("Data Source=*****;Initial Catalog=****;Integrated Security=True")
   cnn.Open()

   Dim cmd As New SqlClient.SqlCommand(sql, cnn)
   cmd.ExecuteNonQuery()
   cnn.Close()

Catch ex As Exception
   TextBoxMessage.Text += ex.Message
   cnn.Close()
End Try

Output:

Domain\UserName

Login failed for user ‘NT AUTHORITY\ANONYMOUS LOGON’.

  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-05-13T07:28:51+00:00Added an answer on May 13, 2026 at 7:28 am

    This is key = The IIS server and SQL server are on different machines. You’re facing the classic double hop issue. Think of it in this way:

    • You access the web application under your credentials
    • IIS in this case has to present who you say you are to the SQL Server
    • IIS says, “Why hello SQL Server, I’m passing on Tony’s kerberos creds, they are legit”
    • SQL Server says, “Hmmm, IIS I’m not sure I trust you, I need proof that you are trusted to present these credentials to me”.

    Thus once you enable delegation as mentioned by Remus, your SQL Server will trust the credentials your IIS server is presenting on your behalf.

    In terms of security, under delegation, it would be wise to choose:

    Trust this computer for delegation for specified services only | Use Kerberos only | and then underneath the “Services to which this account can present delegated credentials” make sure you explicitly set only the server/port you need.

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

How can I force my ASP.Net application to connect to a SQL Server using
I can't seem to get the EF Code First to work with SQL Server
Am I not seeing something obvious here, can't seem to get this to work...
I am using ASP.NET MVC2 in Visual Studio 2008. I believe the SQL Server
This is a silly question but I can't seem to get a clear idea.
I'm making switch from MySQL to SQL Server 2008 Express and can't seem to
How do get the specific exception that has caused a sql server command to
I need a function, but cannot seem to get it quite right, I have
This is a very old problem, but I cannot seem to get my head
So obviously I am doing something wrong, but I just cannot seem to get

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.