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 35 times
0
tereško
- 57,247
- 24
- 95
- 149
Michael Tot Korsgaard
- 3,702
- 10
- 51
- 87
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 !!