允许对 web.config 中的单个文件夹进行匿名身份验证? [英] Allow anonymous authentication for a single folder in web.config?

查看:26
本文介绍了允许对 web.config 中的单个文件夹进行匿名身份验证?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

这里是场景,我有一个使用自定义身份验证的 Asp.Net 应用程序会员资格提供程序,但我们需要允许完全匿名访问(即)应用程序中的特定文件夹.

在 IIS 管理器中,您可以设置文件夹的身份验证模式,但设置保存在 C:WindowsSystem32inetsrvconfigapplicationHost.config 文件 如此处所述

为了使安装更容易,如果我能在 web.config 中设置它会很棒,但经过几次尝试后,我认为这可能是不可能的.

还有谁知道吗?

非常感谢

解决方案

使用 配置标签,以及 > 只允许匿名或 所有:

<预><代码><配置><location path="Path/To/Public/Folder"><system.web><授权><allow users="?"/></授权></system.web></位置></配置>

So here is the scenario, I have an Asp.Net application that is using a custom authentication & membership provider but we need to allow completely anonymous access (i.e.) to a particular folder within the application.

In IIS manager, you can set the authentication mode of a folder, but the settings are saved within C:WindowsSystem32inetsrvconfigapplicationHost.config file as described here

To make installation easier, it would be great if I could set this within my web.config but after a couple of attempts I think this may not be possible.

Does anyone know otherwise?

Many thanks

解决方案

Use <location> configuration tag, and <allow users="?"/> to allow anonymous only or <allow users="*"/> for all:

<configuration>
   <location path="Path/To/Public/Folder">
      <system.web>
         <authorization>
            <allow users="?"/>
         </authorization>
      </system.web>
   </location>
</configuration>

这篇关于允许对 web.config 中的单个文件夹进行匿名身份验证?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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