Condividi tramite


ControllerBase.RedirectToAction Metodo

Definizione

Overload

RedirectToAction()

Reindirizza (Status302Found) a un'azione con lo stesso nome di quello corrente. I nomi "controller" e "action" vengono recuperati dai valori di ambiente della richiesta corrente.

RedirectToAction(String)

Reindirizza (Status302Found) all'azione specificata usando .actionName

RedirectToAction(String, Object)

Reindirizza (Status302Found) all'azione specificata usando e actionNamerouteValues.

RedirectToAction(String, String)

Reindirizza (Status302Found) all'azione specificata usando actionName e controllerName.

RedirectToAction(String, String, Object)

Reindirizza (Status302Found) all'azione specificata usando l'oggetto , controllerNamee routeValuesspecificatiactionName.

RedirectToAction(String, String, String)

Reindirizza (Status302Found) all'azione specificata usando l'oggetto , controllerNamee fragmentspecificatiactionName.

RedirectToAction(String, String, Object, String)

Reindirizza (Status302Found) all'azione specificata usando l'oggetto , , controllerNamerouteValuese fragmentspecificatiactionName.

RedirectToAction()

Origine:
ControllerBase.cs
Origine:
ControllerBase.cs
Origine:
ControllerBase.cs

Reindirizza (Status302Found) a un'azione con lo stesso nome di quello corrente. I nomi "controller" e "action" vengono recuperati dai valori di ambiente della richiesta corrente.

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

Restituisce

Oggetto creato RedirectToActionResult per la risposta.

Attributi

Esempio

Una richiesta POST a un'azione denominata "Product" aggiorna un prodotto e reindirizza a un'azione, denominata anche "Product", che mostra i dettagli del prodotto aggiornato.

[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();
}

Si applica a

RedirectToAction(String)

Origine:
ControllerBase.cs
Origine:
ControllerBase.cs
Origine:
ControllerBase.cs

Reindirizza (Status302Found) all'azione specificata usando .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

Parametri

actionName
String

Nome dell'azione.

Restituisce

Oggetto creato RedirectToActionResult per la risposta.

Attributi

Si applica a

RedirectToAction(String, Object)

Origine:
ControllerBase.cs
Origine:
ControllerBase.cs
Origine:
ControllerBase.cs

Reindirizza (Status302Found) all'azione specificata usando e 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

Parametri

actionName
String

Nome dell'azione.

routeValues
Object

Parametri per una route.

Restituisce

Oggetto creato RedirectToActionResult per la risposta.

Attributi

Si applica a

RedirectToAction(String, String)

Origine:
ControllerBase.cs
Origine:
ControllerBase.cs
Origine:
ControllerBase.cs

Reindirizza (Status302Found) all'azione specificata usando actionName e controllerName.

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

Parametri

actionName
String

Nome dell'azione.

controllerName
String

Nome del controller.

Restituisce

Oggetto creato RedirectToActionResult per la risposta.

Attributi

Si applica a

RedirectToAction(String, String, Object)

Origine:
ControllerBase.cs
Origine:
ControllerBase.cs
Origine:
ControllerBase.cs

Reindirizza (Status302Found) all'azione specificata usando l'oggetto , controllerNamee routeValuesspecificatiactionName.

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

Parametri

actionName
String

Nome dell'azione.

controllerName
String

Nome del controller.

routeValues
Object

Parametri per una route.

Restituisce

Oggetto creato RedirectToActionResult per la risposta.

Attributi

Si applica a

RedirectToAction(String, String, String)

Origine:
ControllerBase.cs
Origine:
ControllerBase.cs
Origine:
ControllerBase.cs

Reindirizza (Status302Found) all'azione specificata usando l'oggetto , controllerNamee fragmentspecificatiactionName.

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

Parametri

actionName
String

Nome dell'azione.

controllerName
String

Nome del controller.

fragment
String

Frammento da aggiungere all'URL.

Restituisce

Oggetto creato RedirectToActionResult per la risposta.

Attributi

Si applica a

RedirectToAction(String, String, Object, String)

Origine:
ControllerBase.cs
Origine:
ControllerBase.cs
Origine:
ControllerBase.cs

Reindirizza (Status302Found) all'azione specificata usando l'oggetto , , controllerNamerouteValuese fragmentspecificatiactionName.

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

Parametri

actionName
String

Nome dell'azione.

controllerName
String

Nome del controller.

routeValues
Object

Parametri per una route.

fragment
String

Frammento da aggiungere all'URL.

Restituisce

Oggetto creato RedirectToActionResult per la risposta.

Attributi

Si applica a