OCDProgrammer.com

It's Microsoft's World, and I'm just living in it
View Clarence Klopfstein's profile on LinkedIn

Clarence Klopfstein's Facebook profile

This site is under construction...

Categories

New Comments

Referring Sites


Disclaimer

  • This is MY blog. The views represented here are not in relation to anybody else. Please read my full disclaimer for a more complete disclaimer.

App_offline.htm – Page Not Found - Solution

December 9, 2009 17:49 by ckincincy

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:

image

Google Chrome shows this as a result:

image

Internet Explorer will show a page similar to this:

image

But Firefox shows the page as you would expect:

image 

 

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: 

image

Now you can see that the three browsers mentioned above will display the page as you would expect:

image

image

image

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.


Comments are closed