Guest User

Untitled

a guest
Aug 13th, 2018
100
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.78 KB | None | 0 0
  1. PUT or DELETE verb in ASP.NET MVC on HTML form
  2. [HttpGet]
  3. public ActionResult Register()
  4. {
  5. return View();
  6. }
  7.  
  8. [HttpPut]
  9. public ActionResult Register(string username, string password)
  10. {
  11. // Registering user
  12. return View();
  13. }
  14.  
  15. <form action='@Url.Action("Register", "User")' method="post">
  16. <div class='field'>
  17. <label for='username'>
  18. Username:
  19. </label>
  20. <input type='text' id='username' name='username' maxlength='100' />
  21. </div>
  22. <div class='field'>
  23. <label for='password'>
  24. Password:
  25. </label>
  26. <input type='password' id='password' name='password' maxlength='50' />
  27. </div>
  28. </form>
  29.  
  30. public static void RegisterRoutes(RouteCollection routes)
  31. {
  32. SimplyRestfulRouteHandler.BuildRoutes(routes);
  33. }
  34.  
  35. <input type="hidden" name="_method" value="put" />
Add Comment
Please, Sign In to add comment