ASp.Net Mvc Core 重定向

在以前老版本的MVC中。重定向直接寫html

HttpContext.Response.Redirect("/404.html")

就行了,程序走到這裏會自動返回302而後跳轉了,code

可是這句話在MVC Core中好像沒有效果了。。。htm

必須在Action中返回一個Redirectblog

  return Redirect("/404.html");

而後這樣纔會被正確的重定向。io

相關文章
相關標籤/搜索