Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- PUT or DELETE verb in ASP.NET MVC on HTML form
- [HttpGet]
- public ActionResult Register()
- {
- return View();
- }
- [HttpPut]
- public ActionResult Register(string username, string password)
- {
- // Registering user
- return View();
- }
- <form action='@Url.Action("Register", "User")' method="post">
- <div class='field'>
- <label for='username'>
- Username:
- </label>
- <input type='text' id='username' name='username' maxlength='100' />
- </div>
- <div class='field'>
- <label for='password'>
- Password:
- </label>
- <input type='password' id='password' name='password' maxlength='50' />
- </div>
- </form>
- public static void RegisterRoutes(RouteCollection routes)
- {
- SimplyRestfulRouteHandler.BuildRoutes(routes);
- }
- <input type="hidden" name="_method" value="put" />
Add Comment
Please, Sign In to add comment