繁体   English   中英

如何确定使用哪种身份验证方法?

[英]How to determine which authentication method is used?

我想知道:我如何确定使用哪种身份验证方法?

例如,如果我的身份验证基于FORMS身份验证而不是WINDOWS身份验证,我想执行代码。

您可以使用配置管理器检查Web配置中的内容

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

您可以在用户的​​标识对象上检索名为AuthenticationType的字符串属性: User.Identity.AuthenticationType

这里有更多文档: http//msdn.microsoft.com/en-us/library/system.security.principal.iidentity.authenticationtype(v=vs.110).aspx

您需要同时具有Windows身份验证和表单身份验证。 为此,您需要配置IIS。 虽然实施起来非常困难。 http://mvolo.com/iis-70-twolevel-authentication-with-forms-authentication-and-windows-authentication/查看上面的博客和下面的讨论: - MVC3混合表单和Windows身份验证希望这对ypu无论如何都有帮助。 :)

暂无
暂无

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM