Compartir a través de


ControllerBase.RedirectToAction Método

Definición

Sobrecargas

RedirectToAction()

Redirige (Status302Found) a una acción con el mismo nombre que el actual. Los nombres "controller" y "action" se recuperan de los valores ambientales de la solicitud actual.

RedirectToAction(String)

Redirige (Status302Found) a la acción especificada mediante actionName.

RedirectToAction(String, Object)

Redirige (Status302Found) a la acción especificada mediante y actionNamerouteValues.

RedirectToAction(String, String)

Redirige (Status302Found) a la acción especificada mediante y actionNamecontrollerName.

RedirectToAction(String, String, Object)

Redirige (Status302Found) a la acción especificada mediante el especificado actionName, controllerNamey routeValues.

RedirectToAction(String, String, String)

Redirige (Status302Found) a la acción especificada mediante el especificado actionName, controllerNamey fragment.

RedirectToAction(String, String, Object, String)

Redirige (Status302Found) a la acción especificada mediante el especificado actionName, controllerName, routeValuesy fragment.

RedirectToAction()

Source:
ControllerBase.cs
Source:
ControllerBase.cs
Source:
ControllerBase.cs

Redirige (Status302Found) a una acción con el mismo nombre que el actual. Los nombres "controller" y "action" se recuperan de los valores ambientales de la solicitud actual.

public:
 virtual Microsoft::AspNetCore::Mvc::RedirectToActionResult ^ RedirectToAction();
[Microsoft.AspNetCore.Mvc.NonAction]
public virtual Microsoft.AspNetCore.Mvc.RedirectToActionResult RedirectToAction ();
[<Microsoft.AspNetCore.Mvc.NonAction>]
abstract member RedirectToAction : unit -> Microsoft.AspNetCore.Mvc.RedirectToActionResult
override this.RedirectToAction : unit -> Microsoft.AspNetCore.Mvc.RedirectToActionResult
Public Overridable Function RedirectToAction () As RedirectToActionResult

Devoluciones

objeto creado RedirectToActionResult para la respuesta.

Atributos

Ejemplos

Una solicitud POST a una acción denominada "Product" actualiza un producto y redirige a una acción, también denominada "Product", que muestra los detalles del producto actualizado.

[HttpGet]
public IActionResult Product(int id)
{
    var product = RetrieveProduct(id);
    return View(product);
}

[HttpPost]
public IActionResult Product(int id, Product product)
{
    UpdateProduct(product);
    return RedirectToAction();
}

Se aplica a

RedirectToAction(String)

Source:
ControllerBase.cs
Source:
ControllerBase.cs
Source:
ControllerBase.cs

Redirige (Status302Found) a la acción especificada mediante actionName.

public:
 virtual Microsoft::AspNetCore::Mvc::RedirectToActionResult ^ RedirectToAction(System::String ^ actionName);
[Microsoft.AspNetCore.Mvc.NonAction]
public virtual Microsoft.AspNetCore.Mvc.RedirectToActionResult RedirectToAction (string actionName);
[Microsoft.AspNetCore.Mvc.NonAction]
public virtual Microsoft.AspNetCore.Mvc.RedirectToActionResult RedirectToAction (string? actionName);
[<Microsoft.AspNetCore.Mvc.NonAction>]
abstract member RedirectToAction : string -> Microsoft.AspNetCore.Mvc.RedirectToActionResult
override this.RedirectToAction : string -> Microsoft.AspNetCore.Mvc.RedirectToActionResult
Public Overridable Function RedirectToAction (actionName As String) As RedirectToActionResult

Parámetros

actionName
String

Nombre de la acción.

Devoluciones

objeto creado RedirectToActionResult para la respuesta.

Atributos

Se aplica a

RedirectToAction(String, Object)

Source:
ControllerBase.cs
Source:
ControllerBase.cs
Source:
ControllerBase.cs

Redirige (Status302Found) a la acción especificada mediante y actionNamerouteValues.

public:
 virtual Microsoft::AspNetCore::Mvc::RedirectToActionResult ^ RedirectToAction(System::String ^ actionName, System::Object ^ routeValues);
[Microsoft.AspNetCore.Mvc.NonAction]
public virtual Microsoft.AspNetCore.Mvc.RedirectToActionResult RedirectToAction (string actionName, object routeValues);
[Microsoft.AspNetCore.Mvc.NonAction]
public virtual Microsoft.AspNetCore.Mvc.RedirectToActionResult RedirectToAction (string? actionName, object? routeValues);
[<Microsoft.AspNetCore.Mvc.NonAction>]
abstract member RedirectToAction : string * obj -> Microsoft.AspNetCore.Mvc.RedirectToActionResult
override this.RedirectToAction : string * obj -> Microsoft.AspNetCore.Mvc.RedirectToActionResult
Public Overridable Function RedirectToAction (actionName As String, routeValues As Object) As RedirectToActionResult

Parámetros

actionName
String

Nombre de la acción.

routeValues
Object

Parámetros de una ruta.

Devoluciones

objeto creado RedirectToActionResult para la respuesta.

Atributos

Se aplica a

RedirectToAction(String, String)

Source:
ControllerBase.cs
Source:
ControllerBase.cs
Source:
ControllerBase.cs

Redirige (Status302Found) a la acción especificada mediante y actionNamecontrollerName.

public:
 virtual Microsoft::AspNetCore::Mvc::RedirectToActionResult ^ RedirectToAction(System::String ^ actionName, System::String ^ controllerName);
[Microsoft.AspNetCore.Mvc.NonAction]
public virtual Microsoft.AspNetCore.Mvc.RedirectToActionResult RedirectToAction (string actionName, string controllerName);
[Microsoft.AspNetCore.Mvc.NonAction]
public virtual Microsoft.AspNetCore.Mvc.RedirectToActionResult RedirectToAction (string? actionName, string? controllerName);
[<Microsoft.AspNetCore.Mvc.NonAction>]
abstract member RedirectToAction : string * string -> Microsoft.AspNetCore.Mvc.RedirectToActionResult
override this.RedirectToAction : string * string -> Microsoft.AspNetCore.Mvc.RedirectToActionResult
Public Overridable Function RedirectToAction (actionName As String, controllerName As String) As RedirectToActionResult

Parámetros

actionName
String

Nombre de la acción.

controllerName
String

El nombre del controlador.

Devoluciones

objeto creado RedirectToActionResult para la respuesta.

Atributos

Se aplica a

RedirectToAction(String, String, Object)

Source:
ControllerBase.cs
Source:
ControllerBase.cs
Source:
ControllerBase.cs

Redirige (Status302Found) a la acción especificada mediante el especificado actionName, controllerNamey routeValues.

public:
 virtual Microsoft::AspNetCore::Mvc::RedirectToActionResult ^ RedirectToAction(System::String ^ actionName, System::String ^ controllerName, System::Object ^ routeValues);
[Microsoft.AspNetCore.Mvc.NonAction]
public virtual Microsoft.AspNetCore.Mvc.RedirectToActionResult RedirectToAction (string actionName, string controllerName, object routeValues);
[Microsoft.AspNetCore.Mvc.NonAction]
public virtual Microsoft.AspNetCore.Mvc.RedirectToActionResult RedirectToAction (string? actionName, string? controllerName, object? routeValues);
[<Microsoft.AspNetCore.Mvc.NonAction>]
abstract member RedirectToAction : string * string * obj -> Microsoft.AspNetCore.Mvc.RedirectToActionResult
override this.RedirectToAction : string * string * obj -> Microsoft.AspNetCore.Mvc.RedirectToActionResult
Public Overridable Function RedirectToAction (actionName As String, controllerName As String, routeValues As Object) As RedirectToActionResult

Parámetros

actionName
String

Nombre de la acción.

controllerName
String

El nombre del controlador.

routeValues
Object

Parámetros de una ruta.

Devoluciones

objeto creado RedirectToActionResult para la respuesta.

Atributos

Se aplica a

RedirectToAction(String, String, String)

Source:
ControllerBase.cs
Source:
ControllerBase.cs
Source:
ControllerBase.cs

Redirige (Status302Found) a la acción especificada mediante el especificado actionName, controllerNamey fragment.

public:
 virtual Microsoft::AspNetCore::Mvc::RedirectToActionResult ^ RedirectToAction(System::String ^ actionName, System::String ^ controllerName, System::String ^ fragment);
[Microsoft.AspNetCore.Mvc.NonAction]
public virtual Microsoft.AspNetCore.Mvc.RedirectToActionResult RedirectToAction (string actionName, string controllerName, string fragment);
[Microsoft.AspNetCore.Mvc.NonAction]
public virtual Microsoft.AspNetCore.Mvc.RedirectToActionResult RedirectToAction (string? actionName, string? controllerName, string? fragment);
[<Microsoft.AspNetCore.Mvc.NonAction>]
abstract member RedirectToAction : string * string * string -> Microsoft.AspNetCore.Mvc.RedirectToActionResult
override this.RedirectToAction : string * string * string -> Microsoft.AspNetCore.Mvc.RedirectToActionResult
Public Overridable Function RedirectToAction (actionName As String, controllerName As String, fragment As String) As RedirectToActionResult

Parámetros

actionName
String

Nombre de la acción.

controllerName
String

El nombre del controlador.

fragment
String

Fragmento que se va a agregar a la dirección URL.

Devoluciones

objeto creado RedirectToActionResult para la respuesta.

Atributos

Se aplica a

RedirectToAction(String, String, Object, String)

Source:
ControllerBase.cs
Source:
ControllerBase.cs
Source:
ControllerBase.cs

Redirige (Status302Found) a la acción especificada mediante el especificado actionName, controllerName, routeValuesy fragment.

public:
 virtual Microsoft::AspNetCore::Mvc::RedirectToActionResult ^ RedirectToAction(System::String ^ actionName, System::String ^ controllerName, System::Object ^ routeValues, System::String ^ fragment);
[Microsoft.AspNetCore.Mvc.NonAction]
public virtual Microsoft.AspNetCore.Mvc.RedirectToActionResult RedirectToAction (string actionName, string controllerName, object routeValues, string fragment);
[Microsoft.AspNetCore.Mvc.NonAction]
public virtual Microsoft.AspNetCore.Mvc.RedirectToActionResult RedirectToAction (string? actionName, string? controllerName, object? routeValues, string? fragment);
[<Microsoft.AspNetCore.Mvc.NonAction>]
abstract member RedirectToAction : string * string * obj * string -> Microsoft.AspNetCore.Mvc.RedirectToActionResult
override this.RedirectToAction : string * string * obj * string -> Microsoft.AspNetCore.Mvc.RedirectToActionResult
Public Overridable Function RedirectToAction (actionName As String, controllerName As String, routeValues As Object, fragment As String) As RedirectToActionResult

Parámetros

actionName
String

Nombre de la acción.

controllerName
String

El nombre del controlador.

routeValues
Object

Parámetros de una ruta.

fragment
String

Fragmento que se va a agregar a la dirección URL.

Devoluciones

objeto creado RedirectToActionResult para la respuesta.

Atributos

Se aplica a