我正在研究ASP.NET Web窗体应用程序,并且在根目录下有一个名为Account
的文件夹。其中主要包含三个ASPX页面:Login.aspx
,ChangePassword.aspx
,ForgotPassword.aspx
。表单身份验证的问题
我使用自定义成员资格提供程序配置了表单身份验证。
的web.config
<authentication mode="Forms">
<forms loginUrl="~/Account/Login.aspx" slidingExpiration="true" timeout="2880" path="/" protection="All" />
</authentication>
<membership defaultProvider="CustomMembershipProvider">
<providers>
<clear/>
<add name="CustomMembershipProvider"
type="App_Code.CustomMembershipProvider, Portal.Web"
connectionStringName="PortalConnectionString"
applicationName="/" />
</providers>
</membership>
如果我尝试访问该页面在其他Account
文件夹比Login.aspx
我被重定向到Login.aspx
,我现在我回避窗体身份验证其他两页如下,
<location path="Account/ChangePassword.aspx">
<system.web>
<authorization>
<allow users="*"/>
</authorization>
</system.web>
</location>
<location path="Account/ForgotPassword.aspx">
<system.web>
<authorization>
<allow users="*"/>
</authorization>
</system.web>
</location>
而不是spe像上面的个别页面可以合并它们吗?我尝试在path
属性中指定文件夹名称Account
,但这不起作用。
接下来的事情我已经叫根Dashboard.aspx
另一页,每当我直接访问它,我想我会被重定向到Account/Login.aspx
页,但它没有发生,为什么呢?