How do I determine which authentication method is being used?

I was wondering: How do I determine which authentication method is being used?

For example, I want to execute code if my authentication is based on FORMS Authentication and not WINDOWS Authentication.

+3


source to share


3 answers


You can check what's in web config using config manager



ConfigurationManager.GetSection("system.web/authentication");

      

+2


source


You can get a string property AuthenticationType

in your object user identification: User.Identity.AuthenticationType

.



More documentation here: http://msdn.microsoft.com/en-us/library/system.security.principal.iidentity.authenticationtype(v=vs.110).aspx

+1


source


You must have both Windows Authentication and Forms Authentication. To do this, you need to configure your IIS. Although this is very difficult to implement. http://mvolo.com/iis-70-twolevel-authentication-with-forms-authentication-and-windows-authentication/ Check the blog above and the discussion below: MVC3 mixed forms and Windows Authentication Hope this helps ypu anyway ... :)

-1


source







All Articles