Wednesday, April 11, 2012

Check Authentication Mode in ASP.NET

At times you may require to check if the current authentication mode (that is, if windows or forms)

You can set the authentication mode using following your web.config file under System.Web section.

authentication mode="Windows"

To know the authentication mode within your page, you can use -
"HttpContext.User.Identity.AuthenticationType".

For Forms Authentication, it will return "Forms".
For Windows, it will return "NTLM" (that stands for NT LAN Manager)

No comments:

Post a Comment

Thanks for visiting my blog.
However, if this helped you in any way, please take a moment to write a comment.

Thanks
Nirman

Blog Archive