asp.net – HttpContext.Current.User.Identity.Name为null
发布时间:2020-12-16 09:11:53 所属栏目:asp.Net 来源:网络整理
导读:我正在尝试使用HttpContext.Current.User.Identity.Name从内部网络获取用户的 Windows登录详细信息,但它是空的. 我已经尝试在Web.Config中更改身份验证模式,但没有任何乐趣: system.web authentication mode="Windows" / compilation debug="true" targetFr
我正在尝试使用HttpContext.Current.User.Identity.Name从内部网络获取用户的
Windows登录详细信息,但它是空的.
我已经尝试在Web.Config中更改身份验证模式,但没有任何乐趣: <system.web> <authentication mode="Windows" /> <compilation debug="true" targetFramework="4.5" /> <httpRuntime targetFramework="4.5" /> </system.web> 我还听说在项目属性中你应该启用Windows身份验证并禁用匿名身份验证,如下所示: 但后来我得到了一个重定向循环,在Chrome中显示“此网页有重定向循环”的消息. 我还检查过我的机器上安装了Windows身份验证: 有关如何解决此问题的任何想法吗? 非常感谢 解决方法
当我有:
<authentication mode="Windows"/> <identity impersonate="true/> 在web.config中我得到当前用户: string currUser = System.Security.Principal.WindowsIdentity.GetCurrent().Name.ToString(); (编辑:李大同) 【声明】本站内容均来自网络,其相关言论仅代表作者个人观点,不代表本站立场。若无意侵犯到您的权利,请及时与联系站长删除相关内容! |
相关内容
- asp.net – 为什么不调用我的SelectCountMethod?
- entity-framework – 数据读取器与指定的模型不兼容
- 什么是部署ASP.Net Web应用程序的好方法?
- asp.net – IIS 7的最大默认POST请求大小 – 如何增加64kB
- wwwtl999999com17708846600Chinese exchangeto launch
- asp-classic – 升级Classic ASP WebApp的最佳方法是什么?
- asp.net-core – 使用asp.net核心发布视图
- asp.net-mvc – MVC视图上的图像显示
- Asp.Net:如何允许访问内部网用户的页面,拒绝外网用户?
- ASP.NET清空缓存时遇到的问题简析
推荐文章
站长推荐
- asp.net-mvc-3 – 基于角色的模型列表授权
- asp.net-mvc – ASP.MVC应用程序常量,什么是最好
- asp.net-mvc – 什么是应用程序洞察遥测(未配置)
- asp.net – Visual WebGui
- ASP.NET Core框架揭秘(持续更新中…)
- 需要在asp.net中以分钟为单位查找音频文件的长度
- asp.net-mvc – ASP.NET Actionlink与glyphicon和
- 适用于ASP.NET Core 2的MultipartFormDataStream
- asp.net-mvc-4 – 无法获取MVC 4 FileExtensions
- asp.net-mvc – MVC项目架构支持模块
热点阅读