Windows身份验证提示输入用户名/密码 [英] Windows Authentication prompts for username/password

查看:208
本文介绍了Windows身份验证提示输入用户名/密码的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我想部署一个客户端网络的应用程序,与AD /域控制器。

I am trying to deploy an application in a client network, with AD/domain controller.

我的应用程序是一个简单的asp.net C#应用程序,使用Windows身份验证。

My application is a simple asp.net c# application, using windows authentication.

我使用WIN2003。

I am using win2003.

基本上,使用VS2008,创建一个新的网站,托管于IIS6.0。
只有2的变化。
1.在应用程序IIS目录安全,启用综合安全。

注:匿名还启用

Basically, using VS2008, create a new website, hosted on IIS6.0. Only 2 changes. 1. On IIS Directory security for the application, enabled "Integrated Security".
Note: anonymous is also enabled.

只有一个改变骨骼code产生的。
下面添加到Default.aspx的的Page_Load方法

Only one change to the skeleton code generated. Add below to the page_load method of default.aspx

using System.Security.Principal;
...
protected void Page_Load(object sender, EventArgs e)
{
    WindowsIdentity id = WindowsIdentity.GetCurrent();
    Response.Write("<B>Windows Identity Check</B><br>");
    Response.Write("Name: " + id.Name + "<br>");
    Response.Write("<BR>");
    Response.Write("User.Identity: " + User.Identity.Name);
    Response.Write("<BR>");
}

浏览页面的输出:
Windows身份验证检查 - 名称: NT AUTHORITY \\ NETWORK SERVICE
User.Identity:

Output of browsing to the page: Windows Identity Check- Name: NT AUTHORITY\NETWORK SERVICE User.Identity:

在User.Identity.Name不会输出当前用户名。

The User.Identity.Name does not output the current username.

正如本文<一个讨论href=\"http://weblogs.asp.net/scottgu/archive/2006/07/12/Recipe_3A00_-Enabling-Windows-Authentication-within-an-Intranet-ASP.NET-Web-application.aspx\">http://weblogs.asp.net/scottgu/archive/2006/07/12/Recipe_3A00_-Enabling-Windows-Authentication-within-an-Intranet-ASP.NET-Web-application.aspx

我说:

<authorization>
    <deny users="?"/>
</authorization>

从我userstand的是,这是增加的时候,我可以从User.Identity.Name获取当前用户的用户名。

From what i userstand is that, when this is added, I can get the current users, username from User.Identity.Name.

但是,一旦我添加了上述情况,现在浏览器会提示我输入用户名和密码。一旦我进入它,我能够使用User.Identity.Name获得的用户名。不过,我不希望用户名/密码弹出出现。我想要的应用程序基于其网络凭据来验证用户。

However, once I added the above, the browser now prompts me for a username and password. Once I enter it, I am able to use User.Identity.Name to get the username. However I do not want the username/password pop up to appear. I want the application to authenticate the user based on their network credentials.

我缺少的东西吗?

推荐答案

您在IIS中配置不正确 - 关闭匿名访问,那么集成的身份验证将踢,假设你也可以通过<设置它在你的web.config / p>

Your configuration in IIS is incorrect - turn off anonymous access, then integrated authentication will kick in, assuming you've also set it in your web.config via

<configuration>
    <system.web>
        <authentication mode="Windows" />
    </system.web>
</configuration>

这篇关于Windows身份验证提示输入用户名/密码的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
相关文章
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆