I have an MVC application that generally uses Basic Authentication. This allows us to change the application user to a different Active Directory user for cetain administrative functions. We do this by setting the response.StausCode = 401 thus :-
Response.Clear();
Response.StatusCode = (Int32)HttpStatusCode.Unauthorized;
Response.AddHeader("WWW-Authenticate", "Realm=Secured Site");
Response.AddHeader("Refresh", "0;");
Response.End();
This works fine but I am now trying to use Windows Authentication on the application but still allowing the user to be changed using the previous method. This again seems to work initially when the application is loaded (ie. navigate to site the select the 'changeuser' actionlink). The problem is that once you have navigated away from the index page clivking the 'changeuser' actionlink never prompts the user to login anymore even though the 401 has been set.
Any guidance appreciated.