jjzjj

IsAjaxRequest

全部标签

c# - 检查 Request.IsAjaxRequest 在我的 asp.net mvc4 中总是返回 false

我的Controller中有以下代码publicActionResultIndex(stringsearchTerm=null){System.Threading.Thread.Sleep(5000);varaccountdefinition=repository.FindAccountDefinition(searchTerm).ToList();if(Request.IsAjaxRequest()){returnPartialView("_CustomerTable",accountdefinition);}returnView(accountdefinition);}但如果我使用

c# - Asp.Net Core MVC 中的 Request.IsAjaxRequest() 在哪里?

为了了解有关令人兴奋的新Asp.Net-5框架的更多信息,我尝试使用新发布的VisualStudio2015CTP-6构建Web应用程序。大多数事情看起来很有前途,但我似乎找不到Request.IsAjaxRequest()-我在旧MVC项目中经常使用的功能。有没有更好的方法来做到这一点-这使得他们删除了这个方法-或者它是否“隐藏”在其他地方?感谢您提供关于在哪里可以找到它或该怎么做的任何建议! 最佳答案 我有点困惑,因为标题提到了MVC5。搜索AjaxintheMVC6githubrepodoesn'tgiveanyrelevan