Is there a way to get the name of the action from which I have been redirected inside a controller in ASP.NET MVC3? (By the way, without saving the name of the action in TempData nor Session)
Asked
Active
Viewed 43 times
0

Guillermo Gutiérrez
- 17,273
- 17
- 89
- 116
-
1The following post which talks about redirecting to the 'previous' action might contain the information you need: http://stackoverflow.com/questions/815229/how-do-i-redirect-to-the-previous-action-in-asp-net-mvc – David Tansey Apr 18 '13 at 22:08
1 Answers
1
how about like this
public ActionResult getAction(string FromActionName){
if(!string.IsEmptyOrNull(FromActionName)){
//Do something with the action name
}else{
//Do nothing
}
return View();
}
and the post action looks like
[HttpPost]
public ActionResult postAction(Model _model){
//some processing
return RedirectToAction("getAction",new{FromActionName="postAction"});
}

Dakait
- 2,531
- 1
- 25
- 43
-
I like the idea. However, it is not quite what I'm looking for. I want to find a way to get the previous action from the data that already exists in the controller. – Guillermo Gutiérrez Apr 19 '13 at 13:56