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); } }
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)); }