如何强制使用本地 asp.net 开发服务器进行 Windows 身份验证?

声明:本页面是StackOverFlow热门问题的中英对照翻译,遵循CC BY-SA 4.0协议,如果您需要使用它,必须同样遵循CC BY-SA许可,注明原文地址和作者信息,同时你必须将它归于原作者(不是我):StackOverFlow 原文地址: http://stackoverflow.com/questions/1143960/
Warning: these are provided under cc-by-sa 4.0 license. You are free to use/share it, But you must attribute it to the original authors (not me): StackOverFlow

提示:将鼠标放在中文语句上可以显示对应的英文。显示中英文
时间:2020-09-15 12:50:02  来源:igfitidea点击:

How do I force windows authentication with local asp.net development server?

asp.netwindowsiisauthentication

提问by CodexArcanum

I'm developing an ASP.NET application which needs Windows Authentication. I have the web.config set up to deny anonymous users and use Windows mode for authentication, but my local development version still lets me pass right through to the site. In order to test different user set-ups, I need to force authorization so I can change users.

我正在开发一个需要 Windows 身份验证的 ASP.NET 应用程序。我已将 web.config 设置为拒绝匿名用户并使用 Windows 模式进行身份验证,但我的本地开发版本仍然允许我直接访问该站点。为了测试不同的用户设置,我需要强制授权以便我可以更改用户。

How do I set up my system (config files, VS2005 settings, IIS, etc?) to force the authorization window to popup on the site when I'm running on local asp.net development server? In other words, how do I get the authentication popup when running the site in Debug mode?

当我在本地 asp.net 开发服务器上运行时,如何设置我的系统(配置文件、VS2005 设置、IIS 等?)以强制在站点上弹出授权窗口?换句话说,在调试模式下运行站点时如何获得身份验证弹出窗口?

采纳答案by Bob

You will also need to configure IIS and have your application point to IIS instead of the local web server

您还需要配置 IIS 并使您的应用程序指向 IIS 而不是本地 Web 服务器

To configure Windows authentication

  1. Start Internet Information Services (IIS).
  2. Right-click your application's virtual directory, and then click Properties.
  3. Click the Directory Security tab.
  4. Under Anonymous access and authentication control, click Edit.
  5. Make sure the Anonymous access check box is not selected and that Integrated Windows > authentication is the only selected check box.

配置 Windows 身份验证

  1. 启动 Internet 信息服务 (IIS)。
  2. 右键单击应用程序的虚拟目录,然后单击“属性”。
  3. 单击目录安全选项卡。
  4. 在匿名访问和身份验证控制下,单击编辑。
  5. 确保未选中匿名访问复选框,并且集成 Windows > 身份验证是唯一选中的复选框。

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

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

To configure your application to point to IIS

将应用程序配置为指向 IIS

  1. Right click on your web project, and then click Properties
  2. Click the Web tab
  3. Click the "Use Local IIS Web Server" radio button
  1. 右键单击您的 Web 项目,然后单击“属性”
  2. 单击 Web 选项卡
  3. 单击“使用本地 IIS Web 服务器”单选按钮