Today while looking over my RSS feeds I saw a post about some changes to the DOTNETBLOGENGINE, while looking over that fellow’s blog I saw a post about App_Offline.htm – Page Not Found. I took a brief read over the article and it reminded me of a time when I ran into this issue.
The Problem
The problem occurs when you turn App_Offline on, Internet Explorer (and apparently Google Chrome) will show a ‘pretty’ 404 error page. Though FireFox will show the contents of the file without issue.
Here is the contents of my App_Offline.htm file:
Google Chrome shows this as a result:
Internet Explorer will show a page similar to this:
But Firefox shows the page as you would expect:
The Solution
Now I remembered the solution pretty much immediately, you have to make the size of the file hit a certain limit. I took a look around the web and found this article which puts the size at 512k. That page recommends fixing this with some comments in the code.
Here is what my new App_Offline.htm file looks:
Now you can see that the three browsers mentioned above will display the page as you would expect:
A Conclusion
Now, during my time of writing this blog post I got an email from Ben. He gives a good justification for using his HTTPModule that his post talked about. When you use App_Offline, all files are inaccessible. Your site is down. Now if you have some admin pages, or if you wanted to edit his solution to white list some IP, so you can test the solution without the general public seeing it using an HTTPModule sounds like a fantastic idea. It, however, is not something you should implement to fix the 404 Page Not Found error.