阅读背景:

Allow Only Ajax Requests For An Action In ASP.NET Core

来源:互联网 

ASP.NET Core offers attributes such as [HttpGet] and [HttpPost] that allow you to restrict the HTTP verbs used to invoke an action. You can also use HttpRequest object's Method property to detect the HTTP verb behind the current request. However, at times you need to know whether a request is an Ajax request or not. You may also need to restrict an action only to Ajax calls. Although thee is no inbuilt way to accomplish this task, you can easily implement such a feature in your application. This article discusses how.ASP.NET Core offers attributes such as [HttpGet




你的当前访问异常,请进行认证后继续阅读剩余内容。

分享到: