Excluding pages from forms auth - ASP.NET

2019-06-20 03:51发布

I understand there are 2 ways of excluding pages from forms auth. Either by using another web.config file in the folder that has pages that need to be excluded or by using the location element

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

I have 20 pages scattered all around the web app, so I cannot create a separate web.config. However, due to the number of pages that need to be excluded, I would rather not want to add the location section for each of these pages.

Is there another option?

1条回答
趁早两清
2楼-- · 2019-06-20 04:43

Unfortunately no. You can only specify one path per location element.

This is mainly due to the complexity of .config file inheritance (multiple possible web.configs and machine.config).

查看更多
登录 后发表回答