locked
Where is the page of "HTTP Error 404.0 - Not Found" RRS feed

  • Question

  • User-1361715659 posted

    Hi,

    When I try to view a broken static file in my website, I get the error page titled "HTTP Error 404.0 - Not Found"
    URL: https://www.xtopia.io/ss.img

    How do I overwrite this setting or change the file itself?

    I found the 404 file at C:\inetpub\custerr\en-US but it is not actually the same file.


    I also try in web.config as below but it shows "The page cannot be displayed because an internal server error has occurred.":
    <httpErrors errorMode="DetailedLocalOnly" existingResponse="Auto">
    <remove statusCode="404" />
    <error statusCode="404" responseMode="ExecuteURL" path="404.htm" />
    </httpErrors>

    Thanks.

    Friday, June 1, 2018 6:04 AM

All replies

  • User1472485574 posted

    Look at this blog. This is how you add your custom error page.

    https://www.sherweb.com/blog/how-to-create-custom-error-pages-in-iis-7-5-with-asp-net/

    -

    Arpan

     

    Friday, June 1, 2018 7:50 PM
  • User-1361715659 posted


    Thanks but i already added the custom error.
    My issue is that it is working with aspx but not working with js and img file.
    Please refer to my link in the first post. Thanks.
    Saturday, June 2, 2018 1:41 AM
  • User283571144 posted

    Hi huislaw,

    As far as I know, the customErrors tag only works for the server pages not for static files(js or image).

    So you will find it show the 404.html page not aspx error page.

    I suggest you could use httperrpr instead of custom error.

    You could opne the iis console manager and find the error pages acion.

    More details, you could refer to below image:

    More details about how to enable the httperror in web config, I suggest you could refer to below aritcle.

    https://docs.microsoft.com/en-us/iis/configuration/system.webserver/httperrors/ 

    Best Regards,

    Brando

    Monday, June 4, 2018 3:10 AM
  • User-1361715659 posted

    Thanks.
    I managed to handle static files such as .js and .img.

    https://www.xtopia.io/nothispage - OK

    https://www.xtopia.io/nothispage.aspx - OK

    https://www.xtopia.io/nothispage.js - OK

    https://www.xtopia.io/WebResource.axd  - Not OK

    But now I noticed the axd file still cannot be handled https://www.xtopia.io/WebResource.axd 

    How can I solve this?

    Thanks.

    Wednesday, June 6, 2018 8:37 AM
  • User283571144 posted

    Hi huislaw,

    As far as I know, the WebResource.axd an HTTP Handler that is part of the .NET Framework that does one thing and one thing only – it is tasked with getting an embedded resource out of a DLL and returning its content. 

    So it will not go to the custom error page. It will only work with httphandler exception.

    Here is a workaround, I suggest you could use url rewrite to to directly redirect the WebResource.axd to 404 error page.

    More details, you could refer to below url rewrite setting.

    <system.webServer>
            <rewrite>
                <rules>
                    <rule name="test" stopProcessing="true">
                        <match url="WebResource.axd" />
                        <action type="Redirect" url="http://localhost:4568/" />
                    </rule>
                </rules>
            </rewrite>
      </system.webServer>

    Result:

     

    Best Regards,

    Brando

    Thursday, June 14, 2018 2:52 AM
  • User-1361715659 posted

    Hi,

    The WebResource.axd is needed for 3rd party component, so we cannot redirect it.

    Is there other way to solve this?

    Thanks.

    Monday, September 3, 2018 2:52 AM