Request.IsAjaxRequest returns false

前端 未结 4 932
感动是毒
感动是毒 2021-01-14 01:26

I have an MVC project in which I have a form with a submit button. I have added a jquery client-side handler that intercepts the form submit event. The javascript function

相关标签:
4条回答
  • 2021-01-14 01:31

    Does CreateItem perform redirect? See Firefox does not preserve custom headers during Ajax request redirect: an ASP.NET MVC solution

    0 讨论(0)
  • 2021-01-14 01:38

    The Request.IsAjaxRequest property should reflect the existence of the X-Requested-With HTTP header. Is this header actually sent to the server? As James suggests, try to profile this with Fiddler or similar proxy server alternatives.

    0 讨论(0)
  • 2021-01-14 01:45

    Well... I apologize. I don't know what has changed, but now IsAjaxRequest is returning true. I compare the code I posted above and what is executing now and I see no difference. I repeatedly got false on this before, and now I repeatedly get true. Surely I am missing something, but I don't see it.

    0 讨论(0)
  • 2021-01-14 01:46

    I'm not sure what the difference would be but a possible way to identify if there is one is to use an HTTP profiling tool like Fiddler (www.fiddlertool.com) and look for possible differences between the two calls.

    0 讨论(0)
提交回复
热议问题