コード例 #1
0
        GenerateClientUrl(HttpContext?httpContext, string?basePath, string path, params object?[]?pathParts)
        {
            if (String.IsNullOrEmpty(path))
            {
                return(path);
            }

            if (basePath != null)
            {
                path = new PathString(basePath).Add(path).Value !;
            }

            string query;
            string processedPath = UrlBuilder.BuildUrl(path, out query, pathParts);

            // many of the methods we call internally can't handle query strings properly, so tack it on after processing
            // the virtual app path and url rewrites

            if (String.IsNullOrEmpty(query))
            {
                return(GenerateClientUrlInternal(httpContext, processedPath));
            }
            else
            {
                return(GenerateClientUrlInternal(httpContext, processedPath) + query);
            }
        }
コード例 #2
0
ファイル: LinkToHelper.cs プロジェクト: maxtoroq/XCST-a
        public static string LinkToDefault(string path, string defaultPath, params object?[]?pathParts)
        {
            if (pathParts is null ||
                pathParts.Length == 0 ||
                pathParts.All(p => p is null || !UrlBuilder.IsDisplayableType(p.GetType())))
            {
                return(LinkTo(defaultPath, pathParts));
            }

            return(LinkTo(path, pathParts));
        }