System.Web.Mvc.UriExtensions.GetRouteParameterValue C# (CSharp) Method

GetRouteParameterValue() public static method

public static GetRouteParameterValue ( this uri, string paramaterName ) : string
uri this
paramaterName string
return string
        public static string GetRouteParameterValue(this Uri uri, string paramaterName)
        {
            RouteInfo routeInfo = new RouteInfo(uri, HttpContext.Current.Request.ApplicationPath);
            return routeInfo.RouteData.Values[paramaterName] != null
                ? routeInfo.RouteData.Values[paramaterName].ToString()
                : null;
        }