开发者

asp.net MVC: how to get the previous action name

开发者 https://www.devze.com 2022-12-29 16:46 出处:网络
I can get the current action name by using the following code var cu开发者_StackOverflow中文版rrentActionName = ControllerContext.RouteData.GetRequiredString(\"action\");

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

var cu开发者_StackOverflow中文版rrentActionName = ControllerContext.RouteData.GetRequiredString("action");

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


Why not saving it in a session variable?

Try this:

Session["lastAction"] = Session["actualAction"];
Session["actualAction"] = ControllerContext.RouteData.GetRequiredString("action");
0

精彩评论

暂无评论...
验证码 换一张
取 消