我在web.config  里这样配置: <customErrors mode="RemoteOnly" defaultRedirect="comments.aspx" >  
error statusCode="404" redirect="comments.aspx" />         
</customErrors> 发现这个配置只对aspx类的页面出错起作用!
例如 别人随便访问不存在的aspx的网页,这样可以成功的转到 comments.aspx但如果别人随便打开一个 asp 或 html的网页,刚显示404错误,说找不到文件,不能转到设定的 comments.aspx页面想请教一下,问题出在哪里?如何正确配置?谢谢!

解决方案 »

  1.   

    error statusCode="404" redirect="comments.aspx" /> 
    ==>
    <error statusCode="404" redirect="comments.aspx" /> 
      

  2.   


    html的网页,IIS自己处理了可以在iis里配置下
      

  3.   

    原内容已经是这样了!
    <customErrors mode="RemoteOnly" defaultRedirect="about/comments.aspx" >  
    <error statusCode="404" redirect="about/comments.aspx" />
    <error statusCode="403" redirect="about/comments.aspx" />
    <error statusCode="500" redirect="about/comments.aspx" />         
            </customErrors>  
      

  4.   

    asp 以及html根本就不会 交给asp.net处理,你的web.config配置肯定会无效.
      

  5.   

    你可以通过重写page类,在里面检测
      

  6.   


    试试这个,找IIS页面那块有
      

  7.   

    因为我的网站经常遇到别人用软件扫描,他们经常用其他一些文件(如asp,js,rar等文件)来post,找漏洞.所以.............有没有谁指同一个比较好处理方法????
    无论网站出是什么错误,都指向我的处理出错的页面!