I'm developing a web application and I need to mix Forms & Windows authentication together.
The approach which I selected is this: authentication method on all the web site has to be forms auth. There is a form page (~/home/Login
) to login in via forms auth. The magic (and trouble) is that only one page (say ~/Home/WinLogin
) has to have auth metod set up to be windows auth. This page is used to read HttpContext.User.Identity.Name
to get the windows user name.
What I don't know is how to set up the win auth on iis6 for the one particular route?
The route looks like ~/Home.ashx/WinLogin
. Ok, but what then? I tried to create a directory Home.ashx in the virtual directory and subdirectory WinLogin. But then ~/Home.ashx/Login
(with the login form) stopped working.
Because on iis6 we have to use a ashx handler it seems that there is no other way how to do it instead of creating a ordinary web page ~/WinLogin.aspx
that does the work. However I wanted to avoid that and use MVC only.
Just for info how to setup iis7: IIS 7.0 Server-Side blog It's not perfect (Mike Volodarsky had to create custom forms auth module), but it works.