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.
Connected.Framework/src/Connected.Runtime/RuntimeExtensions.cs

18 lines
463 B

using Microsoft.AspNetCore.Http;
namespace Connected;
public static class RuntimeExtensions
{
public static bool IsAjaxRequest(this HttpRequest request)
{
if (request is null)
throw new ArgumentNullException(nameof(request));
if (request.Headers is not null && request.Headers.ContainsKey("X-Requested-With"))
return string.Equals(request.Headers["X-Requested-With"], "XMLHttpRequest", StringComparison.OrdinalIgnoreCase);
return false;
}
}