ASP.NET Authentication

Hi Guys,

I have an application and I authenticate users by using <authentication mode="Windows">.

The users are active directory users and they are login to their machine with the same credentials they log in to the application.

My question is how can I check in my application that user already login to his machine and let him login automatically to the application.

Moti Mashiah.NET DeveloperAsked:
Who is Participating?
Here is a good resource to explain standard ASP.NET authentication/authorization methods:

You could try enabling SSO -

You could also use a more heavy handed approach and check for authentication by resolving the user from the HttpContext.Current.Request.LogonUserIdentity property.  In order to get the user that is accessing the page, you want to set your applications authentication mode to Windows, turn off impersonation and add your authorization users/roles; e.g. -
    <authentication mode="Windows" />
    <identity impersonate="false" />
        <allow users="DOMAINNAME\Username" />
        <allow roles="BUILTIN\Administrators" />
        <deny users="*" />

Open in new window

The authentication for your site will look like this:Capture.PNG
Moti Mashiah.NET DeveloperAuthor Commented:
Thank you for your answer. it helped me a lot.

After I configured it for my website I'm getting a popup window to authenticate myself which is fine. So after I authenticate myself it sends me to my application login page.

My question is - how can I detect from my sign in a method that the user authenticate already and let him skip the login page?
Ultimate Tool Kit for Technology Solution Provider

Broken down into practical pointers and step-by-step instructions, the IT Service Excellence Tool Kit delivers expert advice for technology solution providers. Get your free copy now.

Moti Mashiah.NET DeveloperAuthor Commented:
thank you, that was a good article. I have one more issue: why the prompt come up in chrome but not in IE 11.?
Moti Mashiah.NET DeveloperAuthor Commented:
k, I got all this idea. I just can't understand how can I recognize the user who login when it comes to my code. What actually I want to do is to see which user is login and skip him to the main page after the application login.
Moti Mashiah.NET DeveloperAuthor Commented:
Thanks for your help. I figured out how to get the user identity by using security class.

then, User.identity.Name.
Question has a verified solution.

Are you are experiencing a similar issue? Get a personalized answer when you ask a related question.

Have a better answer? Share it in a comment.

All Courses

From novice to tech pro — start learning today.