How to register routing in asp.net mvc4?

Good day,
I have a similar situation...
People are signing up on the website... te filled out the registration form and on successful registration by clicking on the button it needs to get to the page which is located in Areas
How do 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();
 }


and I wrote a browser error upon clicking the link (button code did above)
But in this case registration in the database is.
Here is a screenshot of the error in the browser:
c42a50a276f148ac94239e672caef3ad.png
July 2nd 19 at 13:37
2 answers
July 2nd 19 at 13:39
Solution
Replace the RedirectToAction to simply Redirect("~/Admin/Home") or correct the parameters RedirectToAction("Index", "Home", new {area = "Admin"});
The problem was solved so thanks to Sergey:
return RedirectToAction("Index", new { area = "User", controller="Home" }); - Alvena_Fu commented on July 2nd 19 at 13:42
July 2nd 19 at 13:41
Thank You Sergey.
Now I will try and I will unsubscribe...
Write comments to answer in the comments. When you have solved your problem, write the answer. - Alvena_Fu commented on July 2nd 19 at 13:44
: Well....
And do not tell me how to make a bootstrap button with a link: @Html.ActionLink("Home", "Index", "Home") ? - Elna.Volkman92 commented on July 2nd 19 at 13:47
: @Html.ActionLink("Home", "Index", "Home", null, new{ @class="btn btn-default"}) - Alvena_Fu commented on July 2nd 19 at 13:50
: Thank you very much))) helped out with ideas... - Elna.Volkman92 commented on July 2nd 19 at 13:53
And the latest problem:
There is code:
public ActionResult Register()
{
return View();
}

[HttpPost]
public ActionResult Register(Account account)
{
if (ModelState.IsValid)
{
using (RWOnlineUserDb db = new RWOnlineUserDb())
{
db.Account.Add(account);
db.SaveChanges();
}
ModelState.Clear();
ViewBag.Message = account.FirstName + "" + account.LastName + "Successful registration! ";
}
return View();
}

//Login
public ActionResult Login()
{
return View();
}

[HttpPost]
public ActionResult Login(Account account)
{
using (RWOnlineUserDb db = new RWOnlineUserDb())
{
var usr = db.Account.Where(u => u.Email == account.Email && u.Password == account.Password).FirstOrDefault();
if (usr != null)
{
Session["AccountID"] = usr.AccountID.ToString();
Session["Email"] = usr.Email.ToString();
return RedirectToAction("LoggedIn");
}
else
{
ModelState.AddModelError("", "Not correct email or password!");
}
}
return View();
}

Upon successful registration, the transfer is in the user control panel.

Can you tell me how to register on member home page : Welcome, And what would appear the Name and user Name???? - Alvena_Fu commented on July 2nd 19 at 13:56

Find more questions by tags C#ASP.NET