Click here to Skip to main content
15,881,882 members
Please Sign up or sign in to vote.
0.00/5 (No votes)
See more:
How we can get the requesting page action name in MVC3/4 ?

As shown below we can get requested action name as -


var action = '@HttpContext.Current.Request.RequestContext.RouteData.Values["action"].ToString()';


Waiting for your replys.

Thanks in advance.
Posted

1 solution

You need to be searching for it in the ControllerContext instead of RequestContext. Like this,

C#
var actionName = ControllerContext.RouteData.Values["Action"].ToString();


I have used this[^] ASP.NET forum post as a reference.
 
Share this answer
 

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)



CodeProject, 20 Bay Street, 11th Floor Toronto, Ontario, Canada M5J 2N8 +1 (416) 849-8900