2

Assuming I have User Model as :-

public class User{
  prop UserId
  prop Name
}

Now my Controller is :-

public class MyController: AsyncController
{
  [HttpPost]
  public void Add(User user)
  {

  }
  [HttpPut]
  public void UpdateUser(User user)
  {

  }

}

Now, I use fiddler and I can successfully post data to my Add() but not to PUT method.

Error:- Method not allowed

I have wasted my day with this issue, searched stackoverflow and googled around, but couldn't get it working... I am not getting the solution.

-ve votes are highly appreciated with some comments. Please

  • 1
    http://stackoverflow.com/questions/9161354/enable-http-put-requests-on-net-mvc – Matt Bodily Dec 05 '13 at 15:45
  • Why do you have both? You should be using one or the other. [A Good Reference](http://stackoverflow.com/questions/630453/put-vs-post-in-rest) – Lotok Dec 05 '13 at 15:45
  • James:- I am using Backbone.js, so to follow the Rest flow I am doing it. As per my undertstanding POST=Create Record and PUT= Update record. I know using POST I can achieve both... Hope I am correct! –  Dec 06 '13 at 11:55

1 Answers1

0

If the web server that you are using is IIS puts are not enabled by default. See https://serverfault.com/questions/93424/how-to-enable-put-and-delete-in-iis7

Community
  • 1
  • 1
Mike Beeler
  • 4,081
  • 2
  • 29
  • 44