ReWriteURL and Redirect in net core 2.1
Container:
public class HomeController : Controller
{
public IActionResult Index()
{
//1 and 2 are without changing the URL in broswer
//1. HomeController aController = new HomeController();
return aController.About();
//2.//"PageNotFound" must be in Shared view folder.
return View("PageNotFound").
//3 other changing the URL
return View("Calls");
Response.Redirect("c");
return View("Go");
Redirect("t");
RedirectToAction(...);
}
}
Environment:
<PackageReference Include="Microsoft.AspNetCore.App" />
<PackageReference Include="Microsoft.AspNetCore.Razor.Design" Version="2.1.2" PrivateAssets="All" />
Ref:
http://www.advancesharp.com/questions/100/server-transfer-in-mvc-razor
评论
发表评论