Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

How to get current route information in OnActionExecuting

My URLs look like:

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

where language code is en-us, etc.

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

like image 420
Blankman Avatar asked Jun 03 '10 15:06

Blankman


1 Answers

protected override void OnActionExecuting(System.Web.Mvc.ActionExecutingContext filterContext)
{
    var languagecode = filterContext.RouteData.Values["languagecode"];

    base.OnActionExecuting(filterContext);
}
like image 126
John Farrell Avatar answered Oct 27 '22 00:10

John Farrell