【问题标题】:ASP.NET Page Unauthorization for common pages常见页面的 ASP.NET 页面未授权
【发布时间】:2010-05-13 09:35:17
【问题描述】:

我正在开发一个基于表单的身份验证的 Web 应用程序。除 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 删除这些页面以进行授权??

谢谢, 马赫什

【问题讨论】:

  • 你能发布你的配置规则吗?
  • 感谢亚历克斯的回复。原帖中修改的配置规则。

标签: asp.net unauthorized


【解决方案1】:

试试这个:

<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> 

【讨论】:

  • 非常感谢亚历克斯。你让我今天一整天都感觉很好。 :-)
猜你喜欢
  • 1970-01-01
  • 1970-01-01
  • 1970-01-01
  • 2010-11-18
  • 2017-03-14
  • 2011-12-15
  • 2011-12-02
  • 1970-01-01
  • 2010-10-21
相关资源
最近更新 更多