[英]@HttpContext.Current.User.Identity.Name returns a different user name
I am working on a web application using azure active directory authentication hosted in azure. When I try to display the logged in user using "@HttpContext.Current.User.Identity.Name" it display the user email as expected.我正在使用托管在 azure 中的 azure 活动目录身份验证来处理 web 应用程序。当我尝试使用“@HttpContext.Current.User.Identity.Name”显示登录用户时,它会按预期显示用户 email。 But when some other user logs in at the same time, my UI displays the other user name.但是当其他用户同时登录时,我的 UI 会显示其他用户名。 I am not caching or using static variables to retrieve the logged in user information.我没有缓存或使用 static 变量来检索登录的用户信息。 I tried using the below but same issue exist.我尝试使用以下但存在同样的问题。 Any pointers on the issue to display correct logged in user name?关于显示正确登录用户名的问题的任何指示?
Short answer here... Let me know if it works for you too.在这里简短回答......让我知道它是否也适合你。
Sub CloseConn(ByVal sender As Object, ByVal e As EventArgs)
Request.Cookies.Clear()
FormsAuthentication.SignOut()
Session.Clear()
End Sub
Here's the control on my masterpage: MYMASTER.MASTER这是我的母版页上的控件: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.