I know this isn't the right way, but my server host doesn't give me much choice. But I need to call HomeControllers Index method and return the View it has.
But I need it to be done in the C# section of my default.cshtml when the page loads.
Asked
Active
Viewed 36 times
0
tereško
- 58,060
- 25
- 98
- 150
Michael Tot Korsgaard
- 3,892
- 11
- 53
- 89
1 Answers
1
Calling a new view is nothing but redirecting your application to a new url. If you want to redirect to a new url from view,
@{
Response.Redirect("~/Controller/action");
}
safest way could be,
@{ Response.Redirect("~/Account/LogIn?returnUrl=desiredUrl"); }
Article on redirect from view to view is Here !!