在配置文件中设置完404后,访问动态页会自动跳转到404,但是如果访问静态页,比如 asb.htm 这种情况的时候,404设置是无效的。求解答啊。

解决方案 »

  1.   

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

  2.   


    这种的,访问静态是不好使的。
    我自己的网站就是静态页的404 是好使的,你那里是不是 路径没设置好
    <system.web>
        <compilation debug="false" targetFramework="4.5">
    <buildProviders>  
    <add extension=".html" type="System.Web.Compilation.PageBuildProvider" />  
    </buildProviders>    
        </compilation>  
        <httpRuntime targetFramework="4.5" relaxedUrlToFileSystemMapping="true" requestValidationMode="2.0" />
      
     
         <customErrors mode="Off">
          <error statusCode="404" redirect="/PageNotFound.html" />
          <error statusCode="500" redirect="/InternalServerError.html" />
        </customErrors>
      </system.web>
      

  3.   

    既然静态页不好使就不用咯 用aspx的不行么