Beispiel #1
0
        /// <summary>
        /// Extracts specified GET parameter from an Url.
        /// </summary>
        public static string GetRouteParameterValue(this Uri uri, string paramaterName)
        {
            var routeInfo = new RouteInfo(uri, HttpContext.Current.Request.ApplicationPath);

            return(routeInfo.RouteData.Values[paramaterName] != null ? routeInfo.RouteData.Values[paramaterName].ToString() : null);
        }
Beispiel #2
0
        /// <summary>
        /// Indicates whether supplied Url matches specific controller and action.
        /// </summary>
        public static bool IsRouteMatch(this Uri url, string actionName, string controllerName)
        {
            var routeInfo = new RouteInfo(url, HttpContext.Current.Request.ApplicationPath);

            return(routeInfo.RouteData.Values["controller"].ToString() == controllerName && routeInfo.RouteData.Values["action"].ToString() == actionName);
        }