HttpResponseWrapper.RedirectToRoutePermanent 方法

定義

使用指定的路由參數值、路由名稱,或是兩者都使用,執行永遠從要求的 URL 重新導向至指定的 URL。Performs a permanent redirection from a requested URL to a new URL by using the specified route parameter values, a route name, or both.

多載

RedirectToRoutePermanent(String, Object)

使用對應至新 URL 的路由名稱及路由參數值,執行永遠從要求的 URL 重新導向至指定的 URL。Performs a permanent redirection from a requested URL to a new URL by using a route name and route parameter values that correspond to the new URL.

RedirectToRoutePermanent(Object)

使用指定的路由參數值,執行永遠從要求的 URL 重新導向至指定的 URL。Performs a permanent redirection from a requested URL to a new URL by using the specified route parameter values.

RedirectToRoutePermanent(String)

使用指定的路由名稱,執行永遠從要求的 URL 重新導向至指定的 URL。Performs a permanent redirection from a requested URL to a new URL by using the specified route name.

RedirectToRoutePermanent(RouteValueDictionary)

使用指定的路由參數值,執行永遠從要求的 URL 重新導向至指定的 URL。Performs a permanent redirection from a requested URL to a new URL by using the specified route parameter values.

RedirectToRoutePermanent(String, RouteValueDictionary)

使用指定的路由名稱及路由參數值,執行永遠從要求的 URL 重新導向至指定的 URL。Performs a permanent redirection from a requested URL to a new URL by using the specified route name and route parameter values.

RedirectToRoutePermanent(String, Object)

使用對應至新 URL 的路由名稱及路由參數值,執行永遠從要求的 URL 重新導向至指定的 URL。Performs a permanent redirection from a requested URL to a new URL by using a route name and route parameter values that correspond to the new 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

路由的名稱。The name of the route.

routeValues
Object

路由參數值。The route parameter values.

例外狀況

沒有路由對應到指定的路由參數。No route corresponds to the specified route parameters.

在 HTTP 標頭送出之後嘗試重新導向。Redirection was attempted after the HTTP headers had been sent.

備註

提供此方法的目的是為了方便撰寫程式碼。This method is provided for coding convenience. 這相當於呼叫方法, RedirectPermanent 並將第二個參數設定為 falseIt is equivalent to calling the RedirectPermanent method with the second parameter set to false.

這個方法會使用函式將傳入的物件轉換 routeValuesSystem.Web.Routing.RouteValueDictionary 物件 RouteValueDictionary.RouteValueDictionary(Object)This method converts the object that is passed in routeValues to a System.Web.Routing.RouteValueDictionary object by using the RouteValueDictionary.RouteValueDictionary(Object) constructor. RouteCollection.GetVirtualPath接著會呼叫方法來判斷 URL。The RouteCollection.GetVirtualPath method is then called to determine the URL.

ASP.NET 會傳回 301 HTTP 狀態碼來執行重新導向。ASP.NET performs the redirection by returning a 301 HTTP status code.

適用於

RedirectToRoutePermanent(Object)

使用指定的路由參數值,執行永遠從要求的 URL 重新導向至指定的 URL。Performs a permanent redirection from a requested URL to a new URL by using the specified route parameter values.

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

路由參數值。The route parameter values.

例外狀況

沒有路由對應到指定的路由參數。No route corresponds to the specified route parameters.

在 HTTP 標頭送出之後嘗試重新導向。Redirection was attempted after the HTTP headers had been sent.

備註

提供此方法的目的是為了方便撰寫程式碼。This method is provided for coding convenience. 這相當於呼叫方法, RedirectPermanent(String, Boolean) 並將第二個參數設定為 falseIt is equivalent to calling the RedirectPermanent(String, Boolean) method with the second parameter set to false.

這個方法會使用函式將傳入的物件轉換 routeValuesSystem.Web.Routing.RouteValueDictionary 物件 RouteValueDictionary.RouteValueDictionary(Object)This method converts the object that is passed in routeValues to a System.Web.Routing.RouteValueDictionary object by using the RouteValueDictionary.RouteValueDictionary(Object) constructor. RouteCollection.GetVirtualPath接著會呼叫方法來判斷 URL。The RouteCollection.GetVirtualPath method is then called to determine the URL.

ASP.NET 會傳回 301 HTTP 狀態碼來執行重新導向。ASP.NET performs the redirection by returning a 301 HTTP status code.

適用於

RedirectToRoutePermanent(String)

使用指定的路由名稱,執行永遠從要求的 URL 重新導向至指定的 URL。Performs a permanent redirection from a requested URL to a new URL by using the specified route name.

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

路由的名稱。The name of the route.

例外狀況

沒有路由對應至指定的路由名稱。No route corresponds to the specified route name.

在 HTTP 標頭送出之後嘗試重新導向。Redirection was attempted after the HTTP headers had been sent.

備註

提供此方法的目的是為了方便撰寫程式碼。This method is provided for coding convenience. 這相當於呼叫方法, RedirectPermanent(String, Boolean) 並將第二個參數設定為 falseIt is equivalent to calling the RedirectPermanent(String, Boolean) method with the second parameter set to false.

這個方法會使用方法,將傳入的路由名稱轉換 routeName 成 URL RouteCollection.GetVirtualPathThis method converts the route name that is passed in routeName to a URL by using the RouteCollection.GetVirtualPath method.

ASP.NET 會傳回 301 HTTP 狀態碼來執行重新導向。ASP.NET performs the redirection by returning a 301 HTTP status code.

適用於

RedirectToRoutePermanent(RouteValueDictionary)

使用指定的路由參數值,執行永遠從要求的 URL 重新導向至指定的 URL。Performs a permanent redirection from a requested URL to a new URL by using the specified route parameter values.

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

路由參數值。The route parameter values.

例外狀況

沒有路由對應到指定的路由參數。No route corresponds to the specified route parameters.

在 HTTP 標頭送出之後嘗試重新導向。Redirection was attempted after the HTTP headers had been sent.

備註

提供此方法的目的是為了方便撰寫程式碼。This method is provided for coding convenience. 這相當於呼叫方法, Redirect(String, Boolean) 並將第二個參數設定為 falseIt is equivalent to calling the Redirect(String, Boolean) method with the second parameter set to false.

這個方法會呼叫 RouteCollection.GetVirtualPath 方法來判斷 URL。This method calls the RouteCollection.GetVirtualPath method to determine the URL.

ASP.NET 會傳回 301 HTTP 狀態碼來執行重新導向。ASP.NET performs the redirection by returning a 301 HTTP status code.

適用於

RedirectToRoutePermanent(String, RouteValueDictionary)

使用指定的路由名稱及路由參數值,執行永遠從要求的 URL 重新導向至指定的 URL。Performs a permanent redirection from a requested URL to a new URL by using the specified route name and route parameter values.

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

路由的名稱。The name of the route.

routeValues
RouteValueDictionary

路由參數值。The route parameter values.

例外狀況

沒有路由對應到指定的路由參數。No route corresponds to the specified route parameters.

在 HTTP 標頭送出之後嘗試重新導向。Redirection was attempted after the HTTP headers had been sent.

備註

提供此方法的目的是為了方便撰寫程式碼。This method is provided for coding convenience. 這相當於呼叫方法, Redirect(String, Boolean) 並將第二個參數設定為 falseIt is equivalent to calling the Redirect(String, Boolean) method with the second parameter set to false.

這個方法會呼叫 RouteCollection.GetVirtualPath 方法來判斷 URL。This method calls the RouteCollection.GetVirtualPath method to determine the URL.

ASP.NET 會傳回 301 HTTP 狀態碼來執行重新導向。ASP.NET performs the redirection by returning a 301 HTTP status code.

適用於