Mixing Forms and Windows authentication in .Net 4.5

.net, asp.net, authentication, c#, iis

Solution

I made a MVC 5 solution that makes it look like an external provider, the full source code here:

https://github.com/MohammadYounes/MVC5-MixedAuth

I didn't have the chance to test it on IIS 8, try it and let me know.

Problem

This has been possible up to .Net4.0 and IIS 7.5. The general idea is that you enable anonymous and forms authentication for your intranet site and in a subdirectory you enable windows authentication together with forms authentication and turn off anonymous. By disabling the forms 401 => 302 redirection with some custom code you will be able to get a hold of the users username and domain. If you google for a solution all roads seem to lead to this blog/solution: http://mvolo.com/iis-70-twolevel-authentication-with-forms-authentication-and-windows-authentication/ However when upgrading to .net 4.5 and IIS8 it breaks, Always forcing a 302 redirect to the login page and no means of getting a hold of the usernamen. Has anyone solved this yet?

Original source