I started an MVC 4, .Net 4.5 website with a view to using Forms authentication, so chose that template. The brief then changed, and I needed to swap to using Windows Authentication instead. This is rolled out onto a Windows Server 2008 box with IIS8.
I can't for the life on me turn Forms authentication off. After being authenticated through NTLM successfully, MVC tries to take me to a forms login page. I have tried:
<authentication mode="Windows" >AuthConfig.RegisterAuth();" and "FilterConfig.RegisterGlobalFilters(GlobalFilters.Filters);" in the Application_Start()HttpResponse.SuppressFormsAuthenticationRedirect in the Application_EndRequest.None of this works. The only horrible fudge that has worked (from a fellow stackoverflow post) was to change the below in the web.config - this has some funky side effects though (bouncing back to Home on navigation when the app shouldn't for instance) :
<authentication mode="Windows" >
<!--<forms loginUrl="~/Account/Login" timeout="2880" />-->
<forms loginUrl="~/Home" timeout="2880" />
</authentication>
I feel I am missing some blindingly obvious (probably filter related) change I need to make to disable and remove forms auth from the project. Can anyone suggest the steps I need to take to remove in permanently?
ASP.NET MVC3 and Windows Auth on IIS keeps redirecting to /Account/Login
Check whether you have WebMatrix.Data.dll and/or WebMatrix.WebData.dll deployed in the bin directory of your application. If they are there (and you know you don't use them) then try removing them and accessing a page that requires authentication.
I removed references in the project to WebMatrix, deleted them from the local bin and the remote bin, and the unexpected behaviour stopped.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With