ASP.NET Custom error page for 404 returns 302 for http status

后端 未结 5 940
陌清茗
陌清茗 2020-12-17 20:32

In my asp.net web site I have custom error pages defined as following in my web.config file.



        
5条回答
  •  粉色の甜心
    2020-12-17 21:23

    If you add the following to your 404 page code behind. You will get the correct results -

    Page 404.aspx

    protected void Page_Load(object sender, EventArgs e)
    {
        Response.StatusCode = 404;
    }
    

提交回复
热议问题