我正在研究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
頁,但它沒有發生,爲什麼呢?