关于 windows 认证的 AuthenticationType 的问题

Jueyoung 2010-02-04 02:44:49

WindowsIdentity userIdentity = WindowsIdentity.GetCurrent();
if (userIdentity != null)
{
WindowsPrincipal userPrincipal = new WindowsPrincipal(userIdentity);
Response.Write("------------- WindowsPrincipal ---------------</br>");
Response.Write(String.Format("User : {0} </br>",userPrincipal.Identity.Name));
Response.Write(String.Format("Authentication Mode : {0} </br>", userPrincipal.Identity.AuthenticationType));

Response.Write("</br></br>-------------- System.Web.UI.Page.User ------------------</br>");
Response.Write(String.Format("User : {0} </br>", User.Identity.Name));
Response.Write(String.Format("Authentication Mode : {0} </br>", User.Identity.AuthenticationType ));

Response.Write("</br></br>-------------- System.Web.HttpConterxt.User ------------------</br>");
Response.Write(String.Format("User : {0} </br>", Context.User.Identity.Name));
Response.Write(String.Format("Authentication Mode : {0} </br>", Context.User.Identity.AuthenticationType));

}


运行结果如下:

------------- WindowsPrincipal ---------------
User : domain\userName
Authentication Mode : Kerberos


-------------- System.Web.UI.Page.User ------------------
User : domain\userName
Authentication Mode : Negotiate


-------------- System.Web.HttpConterxt.User ------------------
User : domain\userName
Authentication Mode : Negotiate

我查过了msdn, 上面三中方法 用的都是 System.Security.Principal.IIdentity.AuthenticationType 为什么结果还不一样呢?
请大家帮帮忙 解释下. 谢谢



...全文
355 5 打赏 收藏 转发到动态 举报
写回复
用AI写文章
5 条回复
切换为时间正序
请发表友善的回复…
发表回复
Jueyoung 2010-02-22
  • 打赏
  • 举报
回复
新年回来 忘记结贴了
就当送礼了哈! 谢谢
bychgh 2010-02-05
  • 打赏
  • 举报
回复
帮顶
happyboyxq 2010-02-05
  • 打赏
  • 举报
回复
up
Jueyoung 2010-02-04
  • 打赏
  • 举报
回复
这个应该和加密没有关系才对阿
blue_apple2006 2010-02-04
  • 打赏
  • 举报
回复
加密原理不一样,网络加密要考虑时间戳等问题。所以方式不一样。lz可以去看看加密方面的资料。

62,050

社区成员

发帖
与我相关
我的任务
社区描述
.NET技术交流专区
javascript云原生 企业社区
社区管理员
  • ASP.NET
  • .Net开发者社区
  • R小R
加入社区
  • 近7日
  • 近30日
  • 至今
社区公告

.NET 社区是一个围绕开源 .NET 的开放、热情、创新、包容的技术社区。社区致力于为广大 .NET 爱好者提供一个良好的知识共享、协同互助的 .NET 技术交流环境。我们尊重不同意见,支持健康理性的辩论和互动,反对歧视和攻击。

希望和大家一起共同营造一个活跃、友好的社区氛围。

试试用AI创作助手写篇文章吧