HttpResponseWrapper.RedirectToRoutePermanent 方法

定義

透過指定的路由參數值、路由名稱或兩者,執行從請求的 URL 永久重定向到新 URL。

多載

名稱 Description
RedirectToRoutePermanent(String, Object)

透過使用與新 URL 對應的路由名稱與參數值,執行從請求的 URL 永久重定向到新 URL。

RedirectToRoutePermanent(Object)

透過指定的路由參數值,執行從請求的 URL 永久重定向到新 URL。

RedirectToRoutePermanent(String)

透過指定的路由名稱,執行從請求的 URL 永久重定向到新 URL。

RedirectToRoutePermanent(RouteValueDictionary)

透過指定的路由參數值,執行從請求的 URL 永久重定向到新 URL。

RedirectToRoutePermanent(String, RouteValueDictionary)

透過指定的路由名稱與路由參數值,執行從請求的 URL 永久重定向到新 URL。

RedirectToRoutePermanent(String, Object)

透過使用與新 URL 對應的路由名稱與參數值,執行從請求的 URL 永久重定向到新 URL。

public:
 override void RedirectToRoutePermanent(System::String ^ routeName, System::Object ^ routeValues);
public override void RedirectToRoutePermanent(string routeName, object routeValues);
override this.RedirectToRoutePermanent : string * obj -> unit
Public Overrides Sub RedirectToRoutePermanent (routeName As String, routeValues As Object)

參數

routeName
String

路徑的名稱。

routeValues
Object

路由參數值。

例外狀況

沒有任何路由對應於指定的路由參數。

在 HTTP 標頭傳送後,嘗試重定向。

備註

此方法旨在簡化編碼。 它等同於呼叫 RedirectPermanent 將第二個參數設為 false的方法。

此方法透過構造routeValues子將傳遞的System.Web.Routing.RouteValueDictionary物件轉換為物件RouteValueDictionary.RouteValueDictionary(Object)。 接著呼叫該 RouteCollection.GetVirtualPath 方法來確定 URL。

ASP.NET 透過回傳 301 HTTP 狀態碼來執行重定向。

另請參閱

適用於

RedirectToRoutePermanent(Object)

透過指定的路由參數值,執行從請求的 URL 永久重定向到新 URL。

public:
 override void RedirectToRoutePermanent(System::Object ^ routeValues);
public override void RedirectToRoutePermanent(object routeValues);
override this.RedirectToRoutePermanent : obj -> unit
Public Overrides Sub RedirectToRoutePermanent (routeValues As Object)

參數

routeValues
Object

路由參數值。

例外狀況

沒有任何路由對應於指定的路由參數。

在 HTTP 標頭傳送後,嘗試重定向。

備註

此方法旨在簡化編碼。 它等同於呼叫 RedirectPermanent(String, Boolean) 將第二個參數設為 false的方法。

此方法透過構造routeValues子將傳遞的System.Web.Routing.RouteValueDictionary物件轉換為物件RouteValueDictionary.RouteValueDictionary(Object)。 接著呼叫該 RouteCollection.GetVirtualPath 方法來確定 URL。

ASP.NET 透過回傳 301 HTTP 狀態碼來執行重定向。

另請參閱

適用於

RedirectToRoutePermanent(String)

透過指定的路由名稱,執行從請求的 URL 永久重定向到新 URL。

public:
 override void RedirectToRoutePermanent(System::String ^ routeName);
public override void RedirectToRoutePermanent(string routeName);
override this.RedirectToRoutePermanent : string -> unit
Public Overrides Sub RedirectToRoutePermanent (routeName As String)

參數

routeName
String

路徑的名稱。

例外狀況

沒有路由名稱對應指定路線名稱。

在 HTTP 標頭傳送後,嘗試重定向。

備註

此方法旨在簡化編碼。 它等同於呼叫 RedirectPermanent(String, Boolean) 將第二個參數設為 false的方法。

此方法會將傳送 routeName 的路由名稱轉換為 URL RouteCollection.GetVirtualPath

ASP.NET 透過回傳 301 HTTP 狀態碼來執行重定向。

另請參閱

適用於

RedirectToRoutePermanent(RouteValueDictionary)

透過指定的路由參數值,執行從請求的 URL 永久重定向到新 URL。

public:
 override void RedirectToRoutePermanent(System::Web::Routing::RouteValueDictionary ^ routeValues);
public override void RedirectToRoutePermanent(System.Web.Routing.RouteValueDictionary routeValues);
override this.RedirectToRoutePermanent : System.Web.Routing.RouteValueDictionary -> unit
Public Overrides Sub RedirectToRoutePermanent (routeValues As RouteValueDictionary)

參數

routeValues
RouteValueDictionary

路由參數值。

例外狀況

沒有任何路由對應於指定的路由參數。

在 HTTP 標頭傳送後,嘗試重定向。

備註

此方法旨在簡化編碼。 它等同於呼叫 Redirect(String, Boolean) 將第二個參數設為 false的方法。

此方法呼叫 該 RouteCollection.GetVirtualPath 方法來確定 URL。

ASP.NET 透過回傳 301 HTTP 狀態碼來執行重定向。

另請參閱

適用於

RedirectToRoutePermanent(String, RouteValueDictionary)

透過指定的路由名稱與路由參數值,執行從請求的 URL 永久重定向到新 URL。

public:
 override void RedirectToRoutePermanent(System::String ^ routeName, System::Web::Routing::RouteValueDictionary ^ routeValues);
public override void RedirectToRoutePermanent(string routeName, System.Web.Routing.RouteValueDictionary routeValues);
override this.RedirectToRoutePermanent : string * System.Web.Routing.RouteValueDictionary -> unit
Public Overrides Sub RedirectToRoutePermanent (routeName As String, routeValues As RouteValueDictionary)

參數

routeName
String

路徑的名稱。

routeValues
RouteValueDictionary

路由參數值。

例外狀況

沒有任何路由對應於指定的路由參數。

在 HTTP 標頭傳送後,嘗試重定向。

備註

此方法旨在簡化編碼。 它等同於呼叫 Redirect(String, Boolean) 將第二個參數設為 false的方法。

此方法呼叫 該 RouteCollection.GetVirtualPath 方法來確定 URL。

ASP.NET 透過回傳 301 HTTP 狀態碼來執行重定向。

另請參閱

適用於