how to detect ajax request in asp.net core
Code Example - how to detect ajax request in asp.net core
public class AjaxOnlyAttribute : ActionMethodSelectorAttribute
{
public override bool IsValidForRequest(RouteContext routeContext, ActionDescriptor action)
{
return routeContext.HttpContext.Request.IsAjaxRequest();
}
}