如何实现以下功能?
我的 Controller :
if (something == null)
{
//return the view with 404 http header
return View();
}
//return the view with 200 http header
return View();
最佳答案
随便写
Response.StatusCode = 404;
在返回 View 之前。
关于c# - 如何使用 asp.net mvc View 返回 404,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/13764685/