简体   繁体   English

如何重定向到文件夹内web.config文件中指定的登录页面

[英]how redirect to a login page specified in a web.config file inside folder

I use this web.config file inside a folder to block users. 我在文件夹中使用此web.config文件来阻止用户。 I want to redirect to the page specified here: 我想重定向到此处指定的页面:

<?xml version="1.0"?>
<configuration>
<system.web>
<authentication>
<forms loginUrl="~\paginas\login\loginvendedor2.aspx"/>
</authentication>
<authorization >
<deny users="?"/>
</authorization>
</system.web>
</configuration>

but I get redirected to the page specified in the web.config file in the root of the site 但我被重定向到网站根目录中web.config文件中指定的页面

Web.config has a feature called configuration inheritance. Web.config具有一项称为配置继承的功能。 There is an excellent article here . 有一个很好的文章在这里

You need to edit the web.config file in the root directory and add the attribute inheritInChildApplications="false" to any tags you don't want the web.config in the sub-folder to inherit. 您需要编辑目录中的web.config文件,并向您不希望子文件夹中的web.config继承的任何标签中添加属性inheritInChildApplications="false" It should work on the forms tag. 它应该在forms标签上工作。 However I can't test this right now and you may need to block inheritance from the authenication tag instead. 但是我现在无法测试,您可能需要阻止从authenication标记继承。

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

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