web config 设置
在404.aspx.cs
protected void Page_Load(object sender, EventArgs e) { Response.StatusCode = 404; }
如果是自己处理route Uri 的话
try { throw new HttpException(404, "PageNotFound"); //可以 throw to 404page } catch (Exception ex) { throw ex; }
本文共 456 字,大约阅读时间需要 1 分钟。
web config 设置
在404.aspx.cs
protected void Page_Load(object sender, EventArgs e) { Response.StatusCode = 404; }
如果是自己处理route Uri 的话
try { throw new HttpException(404, "PageNotFound"); //可以 throw to 404page } catch (Exception ex) { throw ex; }
转载于:https://www.cnblogs.com/keatkeat/p/4083732.html