[英]Cant get HttpContext.Current.User.Identity to return values
This project authenticates with System.Security.Principal.WindowsIdentity 此项目使用System.Security.Principal.WindowsIdentity进行身份验证
I had a look at this: Can't get HttpContext.Current.User.Identity to work in my WebMatrix project 我看了一下: 无法让HttpContext.Current.User.Identity在我的WebMatrix项目中工作
IIdentity WinId = HttpContext.Current.User.Identity;//returns no data
WindowsIdentity wi = (WindowsIdentity)WinId;
I have disabled anonymous in my Web.config 我在我的Web.config中禁用了匿名
http://forums.asp.net/t/1901573.aspx?System+web+HttpContext+Current+User+Identity+Name+returns+Empty+string http://forums.asp.net/t/1901573.aspx?System+web+HttpContext+Current+User+Identity+Name+returns+Empty+string
<authorization>
<deny users="?" />
</authorization>
The wierd part is I have another project that uses the same code and has has the same .config but works, 奇怪的是我有另一个项目使用相同的代码并具有相同的.config但是有效,
Have you wrote this in your web config ?? 你有没有在你的网络配置中写这个?
<authentication mode="Windows"/>
and please just take a look this 请看看这个
System.Web.HttpContext.Current.User.Identity.Name Vs System.Environment.UserName in ASP.NET ASP.NET中的System.Web.HttpContext.Current.User.Identity.Name与System.Environment.UserName的对比
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.