Answer the question
In order to leave comments, you need to log in
How to register routing in asp.net mvc4?
Good afternoon,
I have a similar situation...
A person registers on the site... that is, he filled out the registration form and upon successful registration, when he clicks on the button, he should go to the page located in Areas
How can I make a link?
[HttpPost]
public ActionResult Register(Account account)
{
if (ModelState.IsValid)
{
using (RWODb db = new RWODb())
{
db.Account.Add(account);
db.SaveChanges();
}
ModelState.Clear();
return RedirectToAction("~/Areas/Admin/Views/Home/Index.cshtml");
}
return View();
}
Answer the question
In order to leave comments, you need to log in
Replace RedirectToAction with just Redirect("~/Admin/Home") or properly set RedirectToAction("Index", "Home", new {area = "Admin"});
Didn't find what you were looking for?
Ask your questionAsk a Question
731 491 924 answers to any question