ASP.NET Authentication

Hi Guys,

I have an asp.net 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 asp.net application.

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

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

https://www.codeproject.com/Articles/98950/ASP-NET-authentication-and-authorization

-saige-
0
 
it_saigeDeveloperCommented:
You could try enabling SSO - https://msdn.microsoft.com/en-us/library/dd577079.aspx

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. -
<system.web>
    <authentication mode="Windows" />
    <identity impersonate="false" />
    <authorization>
        <allow users="DOMAINNAME\Username" />
        <allow roles="BUILTIN\Administrators" />
        <deny users="*" />
    </authorization>
</system.web>

Open in new window

The authentication for your site will look like this:Capture.PNG
-saige-
0
 
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?
0
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.?
0
 
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.
0
 
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.
0
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.