我做了个404的错误页面,在config里面也配置了,iis上的404映射也做了,为什么找不到页面的时候还是显示的是ie默认的404页面,我自己做的显示不出来呢,各位大侠帮帮忙呗。

解决方案 »

  1.   

    你确定你配置对了?把web-config发出来!!
      

  2.   

    配置文件改下就好了. iis不需要配置的~
      

  3.   


     <customErrors mode="RemoteOnly" defaultRedirect="GenericErrorPage.htm">
                <error statusCode="403" redirect="NoAccess.htm" />
                <error statusCode="404" redirect="FileNotFound.htm" />
            </customErrors>
      

  4.   

    <customErrors mode="On" defaultRedirect="GenericErrorPage.htm"> 
                <error statusCode="403" redirect="NoAccess.htm" /> 
                <error statusCode="404" redirect="FileNotFound.htm" /> 
            </customErrors>
      

  5.   

    这个与mode有关。
    <customerrors>标记有3个值的"mode”属性:
    "on”:意思是总是发出定制错误页面; 
    "off”:意思是从不发出定制错误页面(你总是看到原始的错误信息); 
    "remoteonly”:意思是只有当远程浏览器点击站点时才发出定制错误页面(而在实际机器上点击站点的开发人员看到的是详细的错误信息)。 一般都用remoteonly,这样在服务器上如果发生404,管理员就会看到IE的404错误,便于编程人员查找错误。而用户如果发生404,就会看到你定制的友好错误页面。。
      

  6.   

    <customErrors mode="On" 
    defaultRedirect="GenericErrorPage.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"); 

    ErrorPage.aspx 
    protected void Page_Load(object sender, EventArgs e) 

     ErrorMessageLabel.Text = Application["error"].ToString(); 

      

  7.   

    <customErrors mode="RemoteOnly" defaultRedirect="Error.aspx"> 
    <!-- 
                <error statusCode="403" redirect="NoAccess.htm" /> 
                <error statusCode="404" redirect="FileNotFound.htm" /> 
            --> 
    </customErrors> 
    页面地址是否正确