You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
iot/projects/Infrastructure/Extensions/UrlHelperExtensions.cs

37 lines
1.1 KiB

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