Skip to main content
Stack Overflow
  1. About
  2. For Teams

You are not logged in. Your edit will be placed in a queue until it is peer reviewed.

We welcome edits that make the post easier to understand and more valuable for readers. Because community members review edits, please try to make the post substantially better than how you found it, for example, by fixing grammar or adding additional resources and hyperlinks.

Required fields*

Draft saved
Draft discarded
Cancel
6
  • 1
    As far as I can tell, it's still there. It's an extension method in System.Web.Mvc, class AjaxRequestExtensions. That's for MVC5, I don't know about MVC6... Commented Mar 26, 2015 at 15:21
  • 6
    That's what the OP is asking about: MVC6. Of course it's still there in MVC5. Commented Mar 26, 2015 at 15:37
  • 1
    @PatrykĆwiek Ok, yes, I'm testing MVC6. I might be wrong of course, but it seems to be missing from the "Microsoft.AspNet.Mvc": "6.0.0-beta3" package - or any of the other standard mvc-6 packages that comes with a new mvc-6 project. Commented Mar 26, 2015 at 15:38
  • Not sure about this but try just: IsAjaxRequest(), without the Request. prefix. Commented Mar 26, 2015 at 15:43
  • For a temporary solution on this, I decided to copy and modify the method from System.Web.Mvc.AjaxRequestExtensions. Hope it helps others, until this finds it way to the framework. public static class AjaxRequestExtensions { public static bool IsAjaxRequest(this HttpRequest request) { if (request == null) { throw new ArgumentNullException("request"); } return request.Headers != null && request.Headers["X-Requested-With"] == "XMLHttpRequest"; } } Commented Mar 26, 2015 at 15:57

lang-cs

AltStyle によって変換されたページ (->オリジナル) /