Files
mixtape/zero.Core/Extensions/HttpContextExtensions.cs
T
2020-11-16 01:07:07 +01:00

17 lines
461 B
C#

using Microsoft.AspNetCore.Http;
namespace zero.Core.Extensions
{
internal static class HttpContextExtensions
{
/// <summary>
/// Whether the current request is a backoffice request
/// </summary>
public static bool IsBackofficeRequest(this HttpContext context, string backofficePath)
{
string path = backofficePath.EnsureStartsWith('/').TrimEnd('/');
return context.Request.Path.ToString().StartsWith(path);
}
}
}