使用 ASP.NET 通配符应用程序映射时,Request.ServerVariables[“LOGON_USER”] 为空
当我设置通配符应用程序映射以便 asp.net 处理请求时(将可执行路径设置为 C:\WINDOWS\Microsoft.NET\Framework\v2.0.50727\aspnet_isapi.dll
)LOGON_USER<当我通过
site.com/directory/
访问页面时,/code> 为空 - site.com/directory/default.aspx
返回正确的 LOGON_USER
代码>值。
如何在无需删除应用程序地图的情况下解决此问题?
简单测试:
<%# Request.ServerVariables["LOGON_USER"] %>
如果未设置应用程序映射,则结果为 DOMAIN\UserName
;如果设置了应用程序映射,则结果为空字符串。
编辑:
该站点使用表单身份验证进行管理,但我需要根据当前登录的用户执行 LDAP 查询(并搜索 Active Directory) - 匿名访问已关闭并打开 Windows 集成身份验证。
When I set up wildcard application maps so that asp.net handles requests (setting executable path to C:\WINDOWS\Microsoft.NET\Framework\v2.0.50727\aspnet_isapi.dll
) LOGON_USER
is blank when I access a page via site.com/directory/
- site.com/directory/default.aspx
returns the correct LOGON_USER
value.
How can I fix this without needing to take off application maps?
Simple test:
<%# Request.ServerVariables["LOGON_USER"] %>
Results in DOMAIN\UserName
when application maps not set up, but a blank string when they are.
Edit:
The site uses Forms authentication for administration, but I need to do LDAP queries based on the currently logged in user (and to search Active Directory) - anonymous access is turned off and Windows Integrated Authentication turned on.
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(1)
我以前从未见过这种情况,而且我几乎总是使用通配符映射,但是您是否有任何原因不使用 Request.User (或页面的 User 帮助器属性)而不使用基于字符串的变量?我不确定这是否有帮助,但至少可以更安全地避免拼写错误。
I've never seen that before, and I almost always wildcard map, but is there any reason you're not using Request.User (or the Page's User helper property) instead of the string-based variable? I'm not sure if that'll help, but it is at least more safe from typoes.