I searched all day and I cannot find a solution to this.
I am using Windows authentication for an intranet application. I want to be able to click the link and log in as another user, similar to the options in SharePoint.
I have seen many proposed .net based SO solutions, but have no specific MVC.
I came across HttpUnauthorizedResult
return new HttpUnauthorizedResult();
which forces the user to log in, but I do not believe that you can redirect after logging in.
I also tried
Response.StatusCode = 401; Response.StatusDescription = "Unauthorized"; Response.SuppressContent = true; HttpContext.Current.ApplicationInstance.CompleteRequest();
After three attempts, I get HTTP error 401.0 - Unauthorized
This article is the most detailed that I found, however it is not specifically for mvc, and my attempts to change it failed.
http://www.roelvanlisdonk.nl/?p=825
Someone got this to work, or you can point me in the right direction.
I'm interested in a cross-browser solution, as some of our users are on iPads, etc.
source share