views:

90

answers:

1

I can get the current action name by using the following code

var currentActionName = ControllerContext.RouteData.GetRequiredString("action");

but is it possible to get the previous action name as well?

A: 

Why not saving it in a session variable?

Try this:

Session["lastAction"] = Session["actualAction"];
Session["actualAction"] = ControllerContext.RouteData.GetRequiredString("action");
hkda150
Better approach may be to use TempData as it's cleared each time it is read.
Nissan Fan