简体   繁体   English

绕过Windows身份验证

[英]Bypass Windows Authentication

I have an ASP.NET intranet application that is configured to run in Integrated Windows authentication mode. 我有一个ASP.NET Intranet应用程序,配置为在集成Windows身份验证模式下运行。 It has been working fine until a need came up recently. 它一直工作正常,直到最近出现需求。

What the need is that the Intranet needs to be checked for availability by an availability checker which is a Windows service. 需要通过可用性检查器(Windows服务)检查Intranet的可用性。 What the checker does is hit an ASP.NET page and examine the response object. 检查器的作用是访问ASP.NET页面并检查响应对象。 Since the windows service is not running with a domain user account, it gets 由于Windows服务未使用域用户帐户运行,因此它获得了

The remote server returned an error: (401) Unauthorized. 远程服务器返回错误:(401)未经授权。

I am thinking of adding a new asp.net page for the checker to use and I want to tell the system not to authenticate it. 我正在考虑添加一个新的asp.net页面供我使用的检查器,我想告诉系统不要对它进行身份验证。 But I believe the authentication happens before the application even gets a chance to review the page, that the 401 error is returned before the application code "sees" the page. 但我相信认证发生在应用程序甚至有机会查看页面之前,在应用程序代码“看到”页面之前返回401错误。

What are my options to get by this? 我有什么办法可以解决这个问题?

Thanks! 谢谢!

John 约翰

Besides adding a new folder, as @GordonBell commented, you can use the location element in your root web.config file. 除了添加新文件夹,如@GordonBell所评论,您可以使用根web.config文件中的location元素。

Example: 例:

  <location path="YourFile.aspx">
    <system.web>
      <authorization>
        <allow users="*"/>
      </authorization>
    </system.web>
  </location>

Try this: 尝试这个:

Add a new folder to your website (for example: /Check) 在您的网站上添加一个新文件夹(例如:/ Check)

In /Check, create new web.config containing: 在/ Check中,创建包含以下内容的新web.config:

<configuration>
  <system.web>
    <authentication mode="Windows" />
    <authorization>
      <allow users="?"/>
      <allow users="*"/>
    </authorization>
  </system.web>
</configuration>

Then anything you access in /Check shouldn't be authenticated. 然后,您在/ Check中访问的任何内容都不应进行身份验证。

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM