Skip to main content

Posts

Showing posts from April, 2016

isAjaxRequest issue When Angular Used

isAjaxRequest           Determines whether the specified HTTP request is an AJAX request. Namespace:     System.Web.Mvc Assembly:   System.Web.Mvc (in System.Web.Mvc.dll) Syntax : public static bool IsAjaxRequest( this HttpRequestBase request ) Parameters request Type:  System.Web.HttpRequestBase The HTTP request. Return Value Type:  System.Boolean true  if the specified HTTP request is an AJAX request; otherwise,  false . link to sourse          When we try to send request from AngularJs, this method always return false. Why is this happening is, the angular not set the header X-Request-With property. So we should set it. For that,     var app = angular.module("app", []);     app.config(['$httpProvider', function ($httpProvider) {         $httpProvider.defaults.headers.common['X-Requested-With'] = 'XMLHttpRequ...