Guest User

Untitled

a guest
Oct 17th, 2017
89
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 1.28 KB | None | 0 0
  1. <% Html.EnableClientValidation(); %>
  2. <%= Html.ValidationSummary("Login was unsuccessful. Please correct the errors and try again.") %>
  3.  
  4. <% using(Html.BeginForm("HandleForm", "Home")) {%>
  5. <div class="editor-label">Username:</div>
  6. <div class="editor-field">
  7. <%: Html.TextBoxFor(m => m.UserName) %>
  8. <%: Html.ValidationMessageFor(m => m.UserName) %>
  9. </div>
  10.  
  11. <div class="editor-label">Password:</div>
  12. <div class="editor-field">
  13. <%: Html.PasswordFor(m => m.Password) %>
  14. <%: Html.ValidationMessageFor(m => m.Password) %>
  15. </div>
  16. <p>
  17. <input type="submit" value="Login" />
  18. </p>
  19.  
  20. <%-- <a id="LoginButton" href="#Reports">Login</a>--%>
  21. <% } %>
  22.  
  23.  
  24.  
  25.  
  26.  
  27. /////////////Controller
  28. [HttpPost]
  29. public ActionResult HandleForm(string Username, string Password)
  30. {
  31. if (!ModelState.IsValid)
  32. return View("Index");
  33. return RedirectToAction("Index");
  34. }
  35.  
  36. [HttpPost]
  37. public ActionResult HandleForm(LogOnModel model)
  38. {
  39. if (!ModelState.IsValid)
  40. return View("Index");
  41. return RedirectToAction("Index");
  42. }
Add Comment
Please, Sign In to add comment