Click here to Skip to main content
15,886,199 members
Please Sign up or sign in to vote.
1.00/5 (1 vote)
See more:
Hi All ,

I am working to develop an asp.net web forms that working on the active directory authentication . we need to make a mix mode of form authentication and windows authentication together


is there is any special configuration for IIS is this possible to do?

Thanks
Posted
Comments
F-ES Sitecore 15-Jun-15 9:18am    
Have you googled "asp.net use forms authentication and windows authentication"? There are hacks out there that let you kind of do this, but in general mixed authentication is doomed to fail as they work at different layers in the web stack. If you want mixed authentication then it is normally a sign that your architecture is wrong.

1 solution

Mixed authentication is relatively easy to do. I do suggest searching for examples. I'll briefly explain what I did about 5 years ago.

1. Set your web.config to use Forms Authentication. https://msdn.microsoft.com/en-us/library/7t6b43z4(v=vs.140).aspx[^]
2. Set the login url to a page that will have code which attempts to get the user id from HttpContext.Current.Request.ServerVariables["LOGON_USER"] which is how it will be if windows authentication is turned on.
3. Then enable windows authentication on that one single page. And in the code of that windows logon page if it fails, redirect to a regular LoginPage which will ask for the username and password.

So, essentially what happens is when a request comes in, ASP.Net looks at web.config and sends the user to WindowsLogin.aspx (or whatever you name it). In that page, attempt to get user id from browser and if validated, login them in with FormsAuthentication. If it failes, redirect to a regular LoginPage where they can type in name and password.
 
Share this answer
 
Comments
Thanks7872 15-Jun-15 10:23am    
+5!

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)



CodeProject, 20 Bay Street, 11th Floor Toronto, Ontario, Canada M5J 2N8 +1 (416) 849-8900