繁体   English   中英

@HttpContext.Current.User.Identity.Name 返回不同的用户名

[英]@HttpContext.Current.User.Identity.Name returns a different user name

我正在使用托管在 azure 中的 azure 活动目录身份验证来处理 web 应用程序。当我尝试使用“@HttpContext.Current.User.Identity.Name”显示登录用户时,它会按预期显示用户 email。 但是当其他用户同时登录时,我的 UI 会显示其他用户名。 我没有缓存或使用 static 变量来检索登录的用户信息。 我尝试使用以下但存在同样的问题。 关于显示正确登录用户名的问题的任何指示?

  1. @User.Identity.Name
  2. @HttpContext.Current.User.Identity.Name

在这里简短回答......让我知道它是否也适合你。

Sub CloseConn(ByVal sender As Object, ByVal e As EventArgs)    
    Request.Cookies.Clear()
    FormsAuthentication.SignOut()
    Session.Clear()
End Sub

这是我的母版页上的控件:MYMASTER.MASTER

<asp:LoginStatus OnLoggedOut="ClearAllData" ID="LoginStatus1" runat="server" LogoutPageUrl="http://www.mysite1234.domain/" LogoutText="<%$Resources: Glossary, LogoutText%>" LoginText="" LogoutAction="Refresh" />

暂无
暂无

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

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