开发者

How to get current route information in OnActionExecuting

开发者 https://www.devze.com 2023-01-02 17:27 出处:网络
My URLs look like: www.exam开发者_JAVA百科ple.com/{languagecode}/{controller}/{action}/{id} where language code is en-us, etc.

My URLs look like:

www.exam开发者_JAVA百科ple.com/{languagecode}/{controller}/{action}/{id}

where language code is en-us, etc.

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


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

    base.OnActionExecuting(filterContext);
}
0

精彩评论

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