1
當網站表單身份驗證超時時,我可以重定向到自定義頁面而不是Login.aspx頁面嗎?我有非常標準的表單身份驗證與web.config中的以下代碼。表單驗證超時時如何重定向到自定義頁面?
<forms loginUrl="Login.aspx" timeout="25" slidingExpiration="true" cookieless="UseCookies" defaultUrl="Default.aspx"/>
<customErrors mode="On" defaultRedirect="ErrorPage.aspx">
<error statusCode="401" redirect="TimedOutErrorPage.aspx" />
</customErrors>
<location path="TimedOutErrorPage.aspx">
<system.web>
<authorization>
<allow users="?"/>
</authorization>
</system.web>
</location>
我試圖讓401狀態碼有一個自定義錯誤,但它不能正常工作。它總是返回到Login.aspx。