Alternative to Server.Transfer in ASP.NET Core

前端 未结 3 974
我在风中等你
我在风中等你 2020-12-31 16:14

I am migrating an ASP.NET application to ASP.NET Core and they have some calls to HttpServerUtility.Transfer(string path). However, HttpServerUtility does not

3条回答
  •  一整个雨季
    2020-12-31 16:45

    I believe you are looking for a "named view" return in MVC. Like so,

    [HttpPost]
    public ActionResult Index(string Name)
    {
     ViewBag.Message = "Some message";
     //Like Server.Transfer() in Asp.Net WebForm
     return View("MyIndex");
    }
    

    The above will return that particular view. If you have a condition that governs the view details you can do that too.

提交回复
热议问题