top button
Flag Notify
Site Registration

How to restrict access to Web API method to specific HTTP Verb?

+1 vote
2,855 views
How to restrict access to Web API method to specific HTTP Verb?
posted Aug 25, 2015 by Sathyasree

Share this question
Facebook Share Button Twitter Share Button LinkedIn Share Button

1 Answer

0 votes

Attribute programming plays it's role here. We can easily restrict access to an ASP.NET Web API method to be called using a specific HTTP method. For example, we may required in a scenario to restrict access to a Web API method through HTTP POST only as follows:
[HttpPost]
public void UpdateStudent(Student aStudent)
{
StudentRepository.AddStudent(aStudent);
}

answer Aug 26, 2015 by Shivaranjini
Similar Questions
+2 votes

I want the images should be accessible as part of http page only not by any other mean, no clue any suggestion would have great help.

...