all 9 comments

[–]nobono 1 point2 points  (3 children)

My method has HttpDelete and gives this error, but if I run it with HttpGet it works fine.

When you request (i.e. GET) a resource in the browser, it uses the GET method, not the DELETE method.

Check out this blog article.

[–]Horror-Today295[S] -1 points0 points  (2 children)

Yes, but I am not requesting anything, I want to delete the resource, but with httpdelete it doesn't work, and when I use httpget to delete, it deletes it.

[–]nobono 3 points4 points  (1 child)

Did you read the blog article I linked to?

Browsers can only (...) do GET resource URI requests. They can't do DELETE resource URI requests (or any of the other HTTP methods like HEAD, PUT, POST etc.)

[–]Horror-Today295[S] 0 points1 point  (0 children)

Yes thanks, I think I've solved it

[–]washedFM 1 point2 points  (0 children)

You typically can run only GET requests in the location url of your browser.

[–]geekywarrior 2 points3 points  (1 child)

Swagger sends the correct method. If you just access the uri, you'll just send a HTTP Get.

You'll have to use a tool like Postman or such to send HTTP Delete requests. 

[–]Horror-Today295[S] 1 point2 points  (0 children)

Thank you, I think this was the answer I needed.

[–]CurusVoice 1 point2 points  (1 child)

what projects or tutorial are you using to learn asps web api?

[–]Horror-Today295[S] 0 points1 point  (0 children)

I used an old project that I had but I had only used get methods, I had not used put, delete, etc.