devxlogo

February 2, 2017

Check if an HttpRequest is an Ajax Request

A quick way to check if an HTTP Request is an Ajax request is by examining the X-Requested-With Header value. Please see below: bool isAjaxRequest = request.Headers[“X-Requested-With”] != null &&