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

前端 未结 3 1524
孤街浪徒
孤街浪徒 2020-12-02 14:04

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

3条回答
  •  情话喂你
    2020-12-02 14:37

    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()

提交回复
热议问题