Hi guys, I am using Asp.net MVC5.
In Views/Account/Login.chtml
@using (Html.BeginForm("Login", "Account", new { ReturnUrl = ViewBag.ReturnUrl }, FormMethod.Post, new { @class = "form-horizontal", role = "form" })) { ....................... ....................... ....................... ....................... <div class="form-group"> <div class="col-md-offset-2 col-md-10"> <input type="submit" value="Log in" class="btn btn-default" /> </div> </div> ....................... ....................... ....................... .......................
I want login submit to another page such as About page or Contact page…..Not Home page!
Any idea?
I am waiting for your response, guys
Thanks
Hi,
adnan_salah84
I want login submit to another page such as About page or Contact page…..Not Home page!
Your login (POST) submit goes to the "Account" controller not to the pages (views).
from ur controller u can invoke ur desired view (About page or Contact page).
Hi adnan,
You should do it in controller. Your Code:
@using (Html.BeginForm("Login", "Account", FormMethod.Post) { }
This takes you to Login Action of Account Controller.
public ActionResult Login(Login model) { if (ModelState.IsValid) { //Login Code ...... ...... return RedirectToAction("About", "Home"); } else{ return View(); }
This will take you to About action of Home controller if Login is Validated.
Hope this helps