问题
I am currently working on building a web role in a Azure cloud services. What I want to do is to call the one ActionResult method in HomeController in the run() method in webrole.cs class.
What I did is that I create a new instance of HomeController and call the action directly like this:
HomeController homeController = new HomeController();
homeController.changeView();
The changeView method is like this which basically redirect me to another view in another controller.
public ActionResult changeView()
{
return RedirectToAction("EnvInfoView", "Ingestion");
}
When I run in the debug mode, the return return RedirectToAction("EnvInfoView", "Ingestion"); statement is reached and run, however the view does not change at all.
What should I do, any help is appreciated! Thanks in advance.
来源:https://stackoverflow.com/questions/31433461/how-to-change-the-view-of-an-mvc-in-the-web-role