HttpResponse.SuppressFormsAuthenticationRedirect 屬性

定義

取得或設定值,指定是否應該抑制表單驗證重新導向至登入頁面。Gets or sets a value that specifies whether forms authentication redirection to the login page should be suppressed.

public:
 property bool SuppressFormsAuthenticationRedirect { bool get(); void set(bool value); };
public bool SuppressFormsAuthenticationRedirect { get; set; }
member this.SuppressFormsAuthenticationRedirect : bool with get, set
Public Property SuppressFormsAuthenticationRedirect As Boolean

屬性值

如果應該隱藏表單驗證重新導向,則為 true,否則為 falsetrue if forms authentication redirection should be suppressed; otherwise, false.

備註

根據預設,表單驗證會將 HTTP 401 狀態碼轉換成302,以便重新導向至登入頁面。By default, forms authentication converts HTTP 401 status codes to 302 in order to redirect to the login page. 這不適用於特定的錯誤類別,例如當驗證成功但授權失敗,或目前的要求是 AJAX 或 web 服務要求時。This isn't appropriate for certain classes of errors, such as when authentication succeeds but authorization fails, or when the current request is an AJAX or web service request. 這個屬性可讓您隱藏重新導向行為,並將原始狀態碼傳送給用戶端。This property provides a way to suppress the redirect behavior and send the original status code to the client.

適用於