怎么配置404错误重定向啊?

解决方案 »

  1.   


    <customErrors mode="RemoteOnly" defaultRedirect="GenericErrorPage.htm">
      <error statusCode="404" redirect="错误页" />
      </customErrors>
      

  2.   

    楼上正解,另外要在IIS里也配置一下,不然如果用户访问的扩展名不是.aspx就无法转到404页面
      

  3.   

    <configuration> 
      <system.web> 
      <customErrors mode=”On” defaultRedirect=”error.asp”> 
      <error statusCode=”404″ redirect=”notfound.asp” /> 
      </customErrors> 
      </system.web> 
      </configuration> 
      

  4.   


     defaultRedirect=”error.asp” error.asp是什么页面啊?
      

  5.   

    <customErrors mode="RemoteOnly" defaultRedirect="Error.aspx">   
      <error statusCode="403" redirect="NoAccess.htm" />   
      <error statusCode="404" redirect="FileNotFound.htm" />   
    </customErrors>   
    void Application_Error(object sender, EventArgs e)   
    {   
     Exception objErr = Server.GetLastError().GetBaseException();   
     string error = "发生异常页: " + Request.Url.ToString() + "<br>";   
     error += "异常信息: " + objErr.Message + "<br>";   
     Server.ClearError();   
     Application["error"] = error;   
     Response.Redirect("ErrorPage.aspx");   
    }   
    IIS中添加映射