how to know if the request is ajax in asp.net mvc?

Omu picture Omu · Oct 5, 2010 · Viewed 54.5k times · Source

anybody how can I know if the request is ajax ? (I'm using jquery for ajax)

Answer

Buildstarted picture Buildstarted · Oct 5, 2010

There's also the Request.IsAjaxRequest if you're using a later version of MVC. I don't have version 1 anymore so I can't say if it's in version 1.

If you need this check in Global.asax.cs try this: new HttpRequestWrapper(Request).IsAjaxRequest()