帮助 - Page.User.Identity 在使用时给出 null("") 值 - IIS 7 和 C# 4.0

发布于 2024-09-29 21:22:23 字数 80 浏览 0 评论 0 原文

我的 Web 应用程序在 iis 7 和 C# 4.0 中运行,我的用户身份为 null,我需要获取 Windows 用户名和密码。我需要做什么?

I have my web application running in iis 7 and C# 4.0, I am getting the user identity as null, I need to get the windows username and password. What I need to do ?

如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

扫码二维码加入Web技术交流群

发布评论

需要 登录 才能够评论, 你可以免费 注册 一个本站的账号。

评论(1

归属感 2024-10-06 21:22:23

确保站点在 web.config 中设置为需要 Windows 身份验证。初学者请参见此处:

http://msdn.microsoft.com/en-us/ library/532aee0e.aspx

然后确保您正在处理的页面位于需要经过身份验证的访问者的文件夹中(再次是 web.config)

http://msdn.microsoft.com/en-us/library/wce3kxhd.aspx

当您说需要“获取 Windows 用户名和密码”时这是否意味着您想在代码中检索这些内容。您将无法获取密码 - Windows 不会将其提供给 asp.net。

Make sure the site set up to require windows authentication in web.config. See here for starters:

http://msdn.microsoft.com/en-us/library/532aee0e.aspx

Then make sure the page you are working on is in a folder that requires authenticated visitors (again web.config)

http://msdn.microsoft.com/en-us/library/wce3kxhd.aspx

When you say you need to 'get the windows username and password' does that mean you want to retrieve these in your code. You will not be able to get the password - Windows won't provide that to asp.net.

~没有更多了~
我们使用 Cookies 和其他技术来定制您的体验包括您的登录状态等。通过阅读我们的 隐私政策 了解更多相关信息。 单击 接受 或继续使用网站,即表示您同意使用 Cookies 和您的相关数据。
原文