ASP.NET Страница неавторизации для общих страниц - PullRequest
1 голос
/ 13 мая 2010

Я занимаюсь разработкой веб-приложения с аутентификацией на основе форм. Все страницы должны быть аутентифицированы, кроме страниц AboutUs и ContactUs.

Я настроил все правильно, кроме страниц AboutUs и ContactUs. Поскольку я запрещаю всем пользователям в разделе авторизации, приложение перенаправляет, даже если клиент просматривает страницы AboutUs и ContactUs.

Правила конфигурации

<authentication mode= "Forms">
<forms name=".ASPXAUTH" loginUrl="Login.aspx" timeout="20" protection="All" slidingExpiration="true" />
</authentication>
<authorization>
<deny users="?" />
</authorization>

Не могли бы вы сообщить мне, как я могу сказать asp.net удалить эти страницы для авторизации ??

Спасибо, Махеш

1 Ответ

1 голос
/ 13 мая 2010

Попробуйте это:

<system.web>
    <authentication mode="Forms" >
        <forms loginUrl="login.aspx" name=".ASPNETAUTH" 
                           protection="None" path="/" timeout="20" >
        </forms>
    </authentication>
<!-- This section denies access to all files in this application except for 
     those that you have not explicitly specified by using another setting. -->
    <authorization>
        <deny users="?" /> 
    </authorization>
</system.web>
<!-- This section gives the unauthenticated user access to the AboutUs.aspx page 
     only. It is located in the same folder as this configuration file. -->
<location path="AboutUs.aspx">
    <system.web>
        <authorization>
             <allow users ="*" />
        </authorization>
    </system.web>
</location>
<!-- This section gives the unauthenticated user access to the ContactUs.aspx 
     page only. It is located in the same folder as this configuration file. -->
<location path="ContactUs.aspx">
    <system.web>
        <authorization>
             <allow users ="*" />
        </authorization>
    </system.web>
</location> 
...