Last post Sep 03, 2018 02:52 AM by huislaw
Jun 01, 2018 06:04 AM|huislaw|LINK
When I try to view a broken static file in my website, I get the error page titled
"HTTP Error 404.0 - Not Found"
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" />
Jun 01, 2018 07:50 PM|arpan209|LINK
Look at this blog. This is how you add your custom error page.
Jun 02, 2018 01:41 AM|huislaw|LINK
Jun 04, 2018 03:10 AM|Brando ZWZ|LINK
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.
Jun 06, 2018 08:37 AM|huislaw|LINK
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
How can I solve this?
Jun 14, 2018 02:52 AM|Brando ZWZ|LINK
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.
<rule name="test" stopProcessing="true">
<match url="WebResource.axd" />
<action type="Redirect" url="http://localhost:4568/" />
Sep 03, 2018 02:52 AM|huislaw|LINK
The WebResource.axd is needed for 3rd party component, so we cannot redirect it.
Is there other way to solve this?