Reputation: 281
I've created a custom error page, using this article. This custom error page appears only when aspx page isn't find, and when file(like pdf and other) isn't find - default google's error page appears. How to get custom error page for files? I've tryed to implement this solution on two different machines: on local machine custom error page appears for both .aspx pages and files, but on a server this solution works only for .aspx pages, though config files are the same. What I'm missing? Maybe there are different IIS configuration on this machines, or something? Thanks in advance.
Upvotes: 1
Views: 2691
Reputation: 412
Try setting your Error Page directly in IIS. Take a snapshot of your Web.config before you do this as I'm pretty sure it's going to be modified by IIS once you make this settings change. If memory serves me right you'll see this change in system.webServer and not system.web.
Be advised, if you are operating in a web far though, using mixed version of IIS (Server 2008 and Server 2008 R2 for instance), I've found the settings for 2008 R2 to not be compatible with 2008.
Upvotes: 1
Reputation: 3740
I think this will help you.
<system.web>
<customErrors defaultRedirect="Error.aspx" mode="On">
<error statusCode="500" redirect="Error.aspx"/>
</customErrors>
</system.web>
U can add additional tags and mention available error codes and the page where you want to redirect.
Upvotes: 2