I use this web.config file inside a folder to block users. 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 has a feature called configuration inheritance. 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. It should work on the forms
tag. However I can't test this right now and you may need to block inheritance from the authenication
tag instead.
The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.