In ASP.NET MVC, how does response.redirect work?

后端 未结 5 1278
长情又很酷
长情又很酷 2020-12-13 13:49

I have used response.redirect in classic ASP and ASP.NET webforms. However, with MVC 2.0, I am running into something peculiar.

I have a private method in a contr

5条回答
  •  悲&欢浪女
    2020-12-13 14:39

    In MVC never use Response.Redirect use

    return RedirectToAction("ActionResultName", "ControllerName");
    

    As to WHY to NOT use Response.Redirect in MVC:

    1. Performance issues with it
    2. Not following standard asp.net MVC pattern and conventions that have been built specifically FOR MVC.

提交回复
热议问题