using Microsoft.AspNetCore.Mvc; using System; namespace Infrastructure.Extensions { public static class UrlHelperExtensions { public static string Content2(this IUrlHelper url, string path) { if (string.IsNullOrEmpty(path)) { return path; } if (path.StartsWith("~")) { return url.Content(path); } else if (path.StartsWith("/dfs/")) { return path; } else { return url.Content("~" + path); } } public static string FullAction(this IUrlHelper helper, string action = null, string controller = null, object values = null, string scheme = null, string host = null) { if (helper is null) { throw new ArgumentNullException(nameof(helper)); } return helper.Action(action, controller, values, scheme ?? helper.ActionContext.HttpContext.Request.Scheme, host); } } }