How to change the view of an MVC in the web role

邮差的信 提交于 2019-12-12 03:37:41

问题


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

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!