Question

I sort of want to be able to do mixed windows and forms authentication.

//I want to check the browser the user is using
If(IE || chome)//I know IE and chrome can authenticate without a popup login box
{
    //check windows authentication
    if(generic AD account || AD user doesn't have permissions for this application)
    {
        //Redirect to login page
    }
    else
    {
        //Redirect to main page
    }
}
elsif(IPad || android || Firefox)
{
    //Redirect to login page
}

Is there a way to create some custom code to get windows AD authentication with javascript or can I create a custom ashx page to check authentication?

Was it helpful?

Solution

I didn't find any ways to do this just in the code. I ended up following this method http://msdn.microsoft.com/en-us/library/ms972958.aspx and slightly modifying it. It makes some changes in the settings in IIS through the grphical interface. I also didn't want forms authentication and so I changed it to None for authentication and I put some code in my master page to check a cookie and redirect to a page that can check the browser type with javascript and then redirect to the autologin or login page. I don't like that this method means I have to manualy make changes in IIS because this will add alot of time to setting up the web site when it has to be added on new servers, but this is the only way I could find.

This so far has let me do everything I have ever wanted to be able to do but couldn't with the normal authentication methods (add session count down timer, check session variables from service, combin active directory and custom authentication, notify user if they login from multiple locations) but it has taken a lot more coding and testing to get it working than I thought it would. And I will still be doing a lot more testing before I am happy that it will work correctly once real users start to use it. So if anyone has any suggestions for another way this could be done I would still be interestead in what other ways this could be done.

Licensed under: CC-BY-SA with attribution
Not affiliated with StackOverflow
scroll top