skini82
skini82

Reputation: 436

How to determine which authentication method is used?

I was wondering: How can i determine which authentication method is in use?

For example I want to execute a code if my Authentication is based on FORMS authentication and not if it's WINDOWS Authentication.

Upvotes: 4

Views: 5885

Answers (3)

Suraj Sahoo
Suraj Sahoo

Reputation: 24

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

Upvotes: -1

h0tfus3
h0tfus3

Reputation: 592

You can check what's on the web config using configuration manager

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

Upvotes: 4

Joe R Casey
Joe R Casey

Reputation: 226

You can retrieve a string property called AuthenticationType on your user's identity object: User.Identity.AuthenticationType.

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

Upvotes: 4

Related Questions