Share via


HttpResponse.RedirectLocation 屬性

定義

取得或設定 Http Location 標頭的值。

public:
 property System::String ^ RedirectLocation { System::String ^ get(); void set(System::String ^ value); };
public string RedirectLocation { get; set; }
member this.RedirectLocation : string with get, set
Public Property RedirectLocation As String

屬性值

String

在 HTTP Location 標頭中要傳輸至用戶端的絕對 URI。

例外狀況

已經寫入 HTTP 標頭。

範例

下列範例顯示當您使用 HTTP 301 回應碼撰寫永久重新導向的程式碼時,如何使用這個屬性來指定重新導向 URL。

Response.StatusCode = 301;
Response.Status = "301 Moved Permanently";
Response.RedirectLocation = "http://www.newurl.com ";
Response.End();

適用於