How to get current route information in OnActionExecuting

My urls are as follows:

www.example.com/{languagecode}/{controller}/{action}/{id} 

where the language code is en-us etc.

From the OnActionExecuting event, how can I get these values?

+6
asp.net-mvc routing
source share
1 answer
 protected override void OnActionExecuting(System.Web.Mvc.ActionExecutingContext filterContext) { var languagecode = filterContext.RouteData.Values["languagecode"]; base.OnActionExecuting(filterContext); } 
+14
source share

All Articles