禁用使用Windows身份验证的ASP.NET应用程序的子文件夹(S)认证 [英] Disable authentication on subfolder(s) of an ASP.NET app using windows authentication

查看:576
本文介绍了禁用使用Windows身份验证的ASP.NET应用程序的子文件夹(S)认证的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

是否可以使用Windows身份验证的应用程序ASP.net的一个或多个子文件夹禁用Windows身份验证?

Is it possible to disable windows authentication on one or more subfolders of an ASP.net application using windows authentication?

例如:

一个网站包含包含整个应用程序的部分其他几个文件夹:/前端,/后端/登录

A website contains several other folders that contain parts of the overall application: /frontend, /backend, /login

bin文件夹是在同一水平上,因为这些子文件夹,即网站的根。

The bin folder is on the same level as these subfolder, i.e. the root of the website.

所有这些子文件夹中包含使用二进制文件驻留在该网站的根目录的bin文件夹页。

All of these subfolders contain pages that use binaries that reside in the bin folder of the root of the website.

用户必须输入访问Windows凭据时,在后端文件夹页,但不是在登录或前端文件夹访问一个页面时。

The user must input windows credentials when visiting a page in the backend folder, but not when visiting a page in the login or frontend folder.

我用IIS7

任何想法?

推荐答案

找到了解决方法:


  • 调整applicationHost.config文件,并改变了overrideModeDefault到允许
    对于anonymousAuthentication EN windowsAuthentication部分条目

  • Adjusted the applicationHost.config file and changed the "overrideModeDefault" to "Allow" for the anonymousAuthentication en windowsAuthentication section entries

            <section name="anonymousAuthentication" type="System.WebServer.Configuration.AnonymousAuthenticationSection" overrideModeDefault="Allow" />
            <section name="windowsAuthentication" type="System.WebServer.Configuration.WindowsAuthenticationSection" overrideModeDefault="Allow" />


  • 在web.config中为每个文件夹/文件添加位置标记,需要从Windows身份验证排除

  • Added location tags in the web.config for every folder / file that needed to be excluded from windows authentication

       <location path="pathToDirOrFile">
         <system.webServer>
           <security>
            <authentication>
             <anonymousAuthentication enabled="true" />
             <windowsAuthentication enabled="false" />
            </authentication>
           </security>
          </system.webServer>
       </location>
    


  • 确信这些文件夹中的每一个含有禁用身份模拟

  • Made sure each one of those folders contained a separate web.config file that disables identity impersonation

       <configuration>
        <system.web>
         <identity impersonate="false" />
        </system.web>
       </configuration>
    


  • 这篇关于禁用使用Windows身份验证的ASP.NET应用程序的子文件夹(S)认证的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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