Beispiel #1
0
        static string InternalHash(this UrlHelper urlHelper, [AspMvcAction] string action, [AspMvcController] string controller, Uri uri, [AspMvcArea] string area = "", object routes = null)
        {
            string baseUrl = "/";

            if (uri.If(r => r.Segments.Length > 1).Has())
            {
                baseUrl = baseUrl
                          .AppendSegment(uri.Segments[0])
                          .AppendSegment(uri.Segments[1].Replace("/", string.Empty));
            }

            string urlHash = area
                             .Not(string.IsNullOrWhiteSpace)
                             .ReturnOrDefault(r => urlHelper.ActionArea(action, controller, area), urlHelper.Action(action, controller))
                             .AppendToHashQueryString(routes);

            return(HttpUtility.UrlDecode(baseUrl.SetHash(urlHash)));
        }