HttpResponse.RedirectToRoutePermanent Método
Definição
Executa um redirecionamento permanente de uma URL solicitada para uma nova URL, usando valores de parâmetro de rota, um nome de rota ou ambos.Performs a permanent redirection from a requested URL to a new URL by using route parameter values, a route name, or both.
Sobrecargas
| RedirectToRoutePermanent(String, Object) |
Executa um redirecionamento permanente de uma URL solicitada para uma nova URL, usando os valores de parâmetro de rota e de nome da rota que correspondem à nova URL.Performs a permanent redirection from a requested URL to a new URL by using the route parameter values and the name of the route that correspond to the new URL. |
| RedirectToRoutePermanent(Object) |
Executa um redirecionamento permanente de uma URL solicitada para uma nova URL, usando valores de parâmetro de rota.Performs a permanent redirection from a requested URL to a new URL by using route parameter values. |
| RedirectToRoutePermanent(String) |
Executa um redirecionamento permanente de uma URL solicitada para uma nova URL usando um nome de rota.Performs a permanent redirection from a requested URL to a new URL by using a route name. |
| RedirectToRoutePermanent(RouteValueDictionary) |
Executa um redirecionamento permanente de uma URL solicitada para uma nova URL, usando valores de parâmetro de rota.Performs a permanent redirection from a requested URL to a new URL by using route parameter values. |
| RedirectToRoutePermanent(String, RouteValueDictionary) |
Executa um redirecionamento permanente de uma URL solicitada para uma nova URL, usando valores de parâmetro de rota e um nome de rota.Performs a permanent redirection from a requested URL to a new URL by using route parameter values and a route name. |
RedirectToRoutePermanent(String, Object)
Executa um redirecionamento permanente de uma URL solicitada para uma nova URL, usando os valores de parâmetro de rota e de nome da rota que correspondem à nova URL.Performs a permanent redirection from a requested URL to a new URL by using the route parameter values and the name of the route that correspond to the new URL.
public:
void RedirectToRoutePermanent(System::String ^ routeName, System::Object ^ routeValues);
public void RedirectToRoutePermanent (string routeName, object routeValues);
member this.RedirectToRoutePermanent : string * obj -> unit
Public Sub RedirectToRoutePermanent (routeName As String, routeValues As Object)
Parâmetros
- routeName
- String
O nome da rota.The name of the route.
- routeValues
- Object
Os valores de parâmetro de rota.The route parameter values.
Exceções
Nenhuma rota corresponde aos parâmetros de rotas especificados.No route corresponds to the specified route parameters.
Houve uma tentativa de redirecionamento após o envio dos cabeçalhos HTTP.Redirection was attempted after the HTTP headers had been sent.
Exemplos
O exemplo a seguir mostra como chamar esse método para redirecionar para uma rota denominada Product e que tem parâmetros nomeados productid e category .The following example shows how to call this method to redirect to a route that is named Product and that has parameters that are named productid and category.
Response.RedirectToRoutePermanent("Product",
New With {.productid = "1", .category = "widgets"})
Response.RedirectToRoutePermanent("Product",
new { productid = "1", category = "widgets" });
Comentários
Esse método é fornecido para a conveniência da codificação.This method is provided for coding convenience. É equivalente a chamar o RedirectPermanent método com o segundo parâmetro definido como false .It is equivalent to calling the RedirectPermanent method with the second parameter set to false.
Esse método converte o objeto que é passado routeValues para um System.Web.Routing.RouteValueDictionary objeto usando o RouteValueDictionary.RouteValueDictionary(Object) Construtor.This method converts the object that is passed in routeValues to a System.Web.Routing.RouteValueDictionary object by using the RouteValueDictionary.RouteValueDictionary(Object) constructor. O RouteCollection.GetVirtualPath método é chamado para determinar a URL.The RouteCollection.GetVirtualPath method is then called to determine the URL.
ASP.NET executa o redirecionamento retornando um código de status HTTP 301.ASP.NET performs the redirection by returning a 301 HTTP status code.
Aplica-se a
RedirectToRoutePermanent(Object)
Executa um redirecionamento permanente de uma URL solicitada para uma nova URL, usando valores de parâmetro de rota.Performs a permanent redirection from a requested URL to a new URL by using route parameter values.
public:
void RedirectToRoutePermanent(System::Object ^ routeValues);
public void RedirectToRoutePermanent (object routeValues);
member this.RedirectToRoutePermanent : obj -> unit
Public Sub RedirectToRoutePermanent (routeValues As Object)
Parâmetros
- routeValues
- Object
Os valores de parâmetro de rota.The route parameter values.
Exceções
Nenhuma rota corresponde aos parâmetros de rotas especificados.No route corresponds to the specified route parameters.
Houve uma tentativa de redirecionamento após o envio dos cabeçalhos HTTP.Redirection was attempted after the HTTP headers had been sent.
Exemplos
O exemplo a seguir mostra como chamar esse método para redirecionar para uma rota que tem parâmetros nomeados productid e category .The following example shows how to call this method to redirect to a route that has parameters that are named productid and category.
Response.RedirectToRoutePermanent(
New With {.productid = "1", .category = "widgets"})
Response.RedirectToRoutePermanent(
new { productid = "1", category = "widgets" });
Comentários
Esse método é fornecido para a conveniência da codificação.This method is provided for coding convenience. É equivalente a chamar o RedirectPermanent(String, Boolean) método com o segundo parâmetro definido como false .It is equivalent to calling the RedirectPermanent(String, Boolean) method with the second parameter set to false.
Esse método converte o objeto que é passado routeValues para um System.Web.Routing.RouteValueDictionary objeto usando o RouteValueDictionary.RouteValueDictionary(Object) Construtor.This method converts the object that is passed in routeValues to a System.Web.Routing.RouteValueDictionary object by using the RouteValueDictionary.RouteValueDictionary(Object) constructor. O RouteCollection.GetVirtualPath método é chamado para determinar a URL.The RouteCollection.GetVirtualPath method is then called to determine the URL.
ASP.NET executa o redirecionamento retornando um código de status HTTP 301.ASP.NET performs the redirection by returning a 301 HTTP status code.
Aplica-se a
RedirectToRoutePermanent(String)
Executa um redirecionamento permanente de uma URL solicitada para uma nova URL usando um nome de rota.Performs a permanent redirection from a requested URL to a new URL by using a route name.
public:
void RedirectToRoutePermanent(System::String ^ routeName);
public void RedirectToRoutePermanent (string routeName);
member this.RedirectToRoutePermanent : string -> unit
Public Sub RedirectToRoutePermanent (routeName As String)
Parâmetros
- routeName
- String
O nome da rota.The name of the route.
Exceções
Nenhuma rota corresponde aos parâmetros de rotas especificados.No route corresponds to the specified route parameters.
Houve uma tentativa de redirecionamento após o envio dos cabeçalhos HTTP.Redirection was attempted after the HTTP headers had been sent.
Exemplos
O exemplo a seguir mostra como chamar esse método para redirecionar para uma rota denominada Products .The following example shows how to call this method to redirect to a route that is named Products.
Response.RedirectToRoutePermanent("Products")
Response.RedirectToRoutePermanent("Products");
Comentários
Esse método é fornecido para a conveniência da codificação.This method is provided for coding convenience. É equivalente a chamar o RedirectPermanent(String, Boolean) método com o segundo parâmetro definido como false .It is equivalent to calling the RedirectPermanent(String, Boolean) method with the second parameter set to false.
Esse método converte o nome de rota que é passado routeName para uma URL usando o RouteCollection.GetVirtualPath método.This method converts the route name that is passed in routeName to a URL by using the RouteCollection.GetVirtualPath method.
ASP.NET executa o redirecionamento retornando um código de status HTTP 301.ASP.NET performs the redirection by returning a 301 HTTP status code.
Aplica-se a
RedirectToRoutePermanent(RouteValueDictionary)
Executa um redirecionamento permanente de uma URL solicitada para uma nova URL, usando valores de parâmetro de rota.Performs a permanent redirection from a requested URL to a new URL by using route parameter values.
public:
void RedirectToRoutePermanent(System::Web::Routing::RouteValueDictionary ^ routeValues);
public void RedirectToRoutePermanent (System.Web.Routing.RouteValueDictionary routeValues);
member this.RedirectToRoutePermanent : System.Web.Routing.RouteValueDictionary -> unit
Public Sub RedirectToRoutePermanent (routeValues As RouteValueDictionary)
Parâmetros
- routeValues
- RouteValueDictionary
Os valores de parâmetro de rota.The route parameter values.
Exceções
Nenhuma rota corresponde aos parâmetros de rotas especificados.No route corresponds to the specified route parameters.
Houve uma tentativa de redirecionamento após o envio dos cabeçalhos HTTP.Redirection was attempted after the HTTP headers had been sent.
Exemplos
O exemplo a seguir mostra como chamar esse método para redirecionar para uma rota que tem parâmetros nomeados productid e category .The following example shows how to call this method to redirect to a route that has parameters that are named productid and category.
Response.RedirectToRoutePermanent(
new RouteValueDictionary {productId="1", category="widgets"})
Response.RedirectToRoutePermanent(
new RouteValueDictionary {productId="1", category="widgets"});
Comentários
Esse método é fornecido para a conveniência da codificação.This method is provided for coding convenience. É equivalente a chamar o Redirect(String, Boolean) método com o segundo parâmetro definido como false .It is equivalent to calling the Redirect(String, Boolean) method with the second parameter set to false.
Esse método chama o RouteCollection.GetVirtualPath método para determinar a URL.This method calls the RouteCollection.GetVirtualPath method to determine the URL.
ASP.NET executa o redirecionamento retornando um código de status HTTP 301.ASP.NET performs the redirection by returning a 301 HTTP status code.
Aplica-se a
RedirectToRoutePermanent(String, RouteValueDictionary)
Executa um redirecionamento permanente de uma URL solicitada para uma nova URL, usando valores de parâmetro de rota e um nome de rota.Performs a permanent redirection from a requested URL to a new URL by using route parameter values and a route name.
public:
void RedirectToRoutePermanent(System::String ^ routeName, System::Web::Routing::RouteValueDictionary ^ routeValues);
public void RedirectToRoutePermanent (string routeName, System.Web.Routing.RouteValueDictionary routeValues);
member this.RedirectToRoutePermanent : string * System.Web.Routing.RouteValueDictionary -> unit
Public Sub RedirectToRoutePermanent (routeName As String, routeValues As RouteValueDictionary)
Parâmetros
- routeName
- String
O nome da rota.The name of the route.
- routeValues
- RouteValueDictionary
Os valores de parâmetro de rota.The route parameter values.
Exceções
Nenhuma rota corresponde aos parâmetros de rotas especificados.No route corresponds to the specified route parameters.
Houve uma tentativa de redirecionamento após o envio dos cabeçalhos HTTP.Redirection was attempted after the HTTP headers had been sent.
Exemplos
O exemplo a seguir mostra como chamar esse método para redirecionar para uma rota denominada Product e que tem parâmetros nomeados productid e category .The following example shows how to call this method to redirect to a route that is named Product and that has parameters that are named productid and category.
Response.RedirectToRoutePermanent("Product",
new RouteValueDictionary {productId="1", category="widgets"})
Response.RedirectToRoutePermanent("Product",
new RouteValueDictionary {productId="1", category="widgets"});
Comentários
Esse método é fornecido para a conveniência da codificação.This method is provided for coding convenience. É equivalente a chamar o Redirect(String, Boolean) método com o segundo parâmetro definido como false .It is equivalent to calling the Redirect(String, Boolean) method with the second parameter set to false.
Esse método chama o RouteCollection.GetVirtualPath método para determinar a URL.This method calls the RouteCollection.GetVirtualPath method to determine the URL.
ASP.NET executa o redirecionamento retornando um código de status HTTP 301.ASP.NET performs the redirection by returning a 301 HTTP status code.