httpverbs

Why are OPTIONS requests not arriving in my ASP.NET application?

浪子不回头ぞ 提交于 2019-12-01 16:50:52
问题 I can't seem to receive HTTP OPTIONS requests in my IIS6 hosted ASP.NET application. I'm testing it using a debug breakpoint (and file-log) in my Global.asax 's Application_BeginRequest method. The breakpoint is never hit and the client gets a HTTP 403 Forbidden, I'm assuming from IIS6 directly ( GET s and POST s work fine btw). I've tried several things in the web.config , including adding the following line to either and both the <system.webServer><handlers> and <system.web><httpHandlers>

How to specify DELETE method in a link or form?

大城市里の小女人 提交于 2019-11-30 16:50:46
Rfc2616 lists many methods besides GET and POST, like, say, DELETE, PUT etc. Method field in html forms, though, seems to be allowed to specify only GET or POST. Is it possible to create a link or form in a html page that uses a request method that is not GET or POST? Paul D. Waite You certainly can’t create a link that uses anything other than GET . Since HTML began, links have been meant to be idempotent and free from side effects. For forms and XMLHTTPRequests , Caps’ link is the place to look: Are the PUT, DELETE, HEAD, etc methods available in most web browsers? . Was trying to figure

Defining Idempotence

给你一囗甜甜゛ 提交于 2019-11-30 12:58:29
So "idempotence" can be defined as: An action, that if performed N times has the same effect as performing the action only once. Got it, easy enough. My question is about the subtlety of this definition -is an action considered idempotent by itself, or must you also consider the data being passed into the action? Let me clarify with an example: Suppose I have a PUT method that updates some resource, we'll call it f(x) Obviously, f(3) is idempotent, as long as I supply 3 as the input. And equally obvious, f(5) will change the value of the resource (i.e., it will no longer be 3 or whatever value

Using LINK and UNLINK HTTP verbs in a REST API

て烟熏妆下的殇ゞ 提交于 2019-11-30 12:35:38
问题 I am currently working on implementing a REST API. I have a resource model with a large number of relationships between the individual resources. My question is: how do you link two existing resources to each other (establishing a relationship) in a RESTful manner? One solution I came across was the use of the LINK and UNLINK HTTP verbs. The API consumer would be able to link two resources using LINK and following URI: /resource1/:id1/resource2/:id2. The problem with this solution is the lack

How can I overload ASP.NET MVC Actions based on the accepted HTTP verbs?

陌路散爱 提交于 2019-11-30 10:58:01
Wanted to use the same URL for a GET/PUT/DELETE/POST for a REST based API, but when the only thing different about the Actions is which HTTP verbs it accepts, it considers them to be duplicate! "Type already defines a member called 'Index' with the same parameter types." To which I said, so what? This one only accepts GET, this one only accepts POST... should be able to be co-exist right? How? That's not ASP.NET MVC limitation or whatever. It's .NET and how classes work: no matter how hard you try, you cannot have two methods with the same name on the same class which take the same parameters.

Using LINK and UNLINK HTTP verbs in a REST API

允我心安 提交于 2019-11-30 03:03:46
I am currently working on implementing a REST API. I have a resource model with a large number of relationships between the individual resources. My question is: how do you link two existing resources to each other (establishing a relationship) in a RESTful manner? One solution I came across was the use of the LINK and UNLINK HTTP verbs. The API consumer would be able to link two resources using LINK and following URI: /resource1/:id1/resource2/:id2. The problem with this solution is the lack of support for the LINK and UNLINK verbs. Neither http://www.w3.org/Protocols/rfc2616/rfc2616-sec9

Defining Idempotence

我只是一个虾纸丫 提交于 2019-11-29 17:54:21
问题 So "idempotence" can be defined as: An action, that if performed N times has the same effect as performing the action only once. Got it, easy enough. My question is about the subtlety of this definition -is an action considered idempotent by itself, or must you also consider the data being passed into the action? Let me clarify with an example: Suppose I have a PUT method that updates some resource, we'll call it f(x) Obviously, f(3) is idempotent, as long as I supply 3 as the input. And

How to get PUT and DELETE verbs to work with WebAPI on IIS

倾然丶 夕夏残阳落幕 提交于 2019-11-29 07:47:22
I am using WebAPI PUT and DELETE methods to perform actions from my website via AJAX using jQuery. My server is Windows Server 2008 R2 with Plesk installed. POST and GET requests work just fine, but PUT and DELETE fail. I was originally getting a 401 Unauthorized response when I first deployed my site to the server. I then performed some actions and it turned into 405 Method not allowed . I am now at a point where I'm receiving an Internal Server error: Handler “ExtensionlessUrlHandler-Integrated-4.0” has a bad module “ManagedPipelineHandler” in its module list Now, there are lots of posts

ASP.NET MVC AcceptVerbs and registering routes

北城以北 提交于 2019-11-28 09:42:07
do I have to register the HttpVerb constraint in my route definition (when i'm registering routes) if i have decorated my action method with the [AcceptVerbs(..)] attribute already? eg. i have this. [AcceptVerbs(HttpVerbs.Post)] public ActionResult Create(FormCollection formCollection) { .. } do i need to add this to the route that refers to this action, as a constraint? Haacked The difference between the two is the following: Let's assume the Create method in question is on the HomeController . Using the AcceptVerbs attribute does not affect routing. It's actually something used by the action

Combine GET and POST request methods in Spring

﹥>﹥吖頭↗ 提交于 2019-11-28 04:49:08
I have a resource that supports both GET and POST requests. Here a sample code for a sample resource: @RequestMapping(value = "/books", method = RequestMethod.GET) public ModelAndView listBooks(@ModelAttribute("booksFilter") BooksFilter filter, two @RequestParam parameters, HttpServletRequest request) throws ParseException { LONG CODE } @RequestMapping(value = "/books", method = RequestMethod.POST) public ModelAndView listBooksPOST(@ModelAttribute("booksFilter") BooksFilter filter, BindingResult result) throws ParseException { SAME LONG CODE with a minor difference } The code in the two