Click here to Skip to main content
10,500,000 members (67,086 online)
Click here to Skip to main content
Add your own
alternative version


18 bookmarked
Posted 16 Aug 2008

How to redirect the user to a "Down for Maintenance" page in ASP.NET

, 16 Aug 2008
Rate this:
Please Sign up or sign in to vote.
This article will help you understand a superb hidden feature of ASP.NET. Using this feature, you could easily redirect all your website traffic to a "Down for Maintenance" page.


Usually, there arises a scenario when we upgrade our production site to a new release, we want the users to be redirected to the “Down for Maintenance” page. This article will help you understand the easiest technique to redirect all your website traffic to a standard "Down for Maintenance" HTML page.

How to redirect a user to a "Down for Maintenance" page?

The best way to implement this is using the app_offline.htm file. ASP.NET 2.0 has provided a fantastic functionality using which the users will automatically be redirected to the “Down for Maintenance” page. Just add an HTML file named “app_offline.htm” to the root directory of your website. Adding this file will clear the server cache. When ASP.NET sees the app_offline.htm file, it will shut-down the app-domain for the application (and not restart it for requests), and instead send back the contents of the app_offline.htm file in response to all new dynamic requests for the application.

Please take a note that the size of the file should be more that 512 bytes to be displayed. If the size of the file is less that 512 bytes, then IE browser settings need to be changed manually. The "Show Friendly HTTP Errors" check box from the Tools->Internet Options->Advanced tab within IE settings need to be unchecked. If this check-box is not unchecked and the app_offline.htm file size is less that 512 bytes, then the standard IE “Page cannot be displayed” message will be shown.

To start the website again, just remove this file from the root folder of your website. This will trigger the ASP.NET engine to cache all the page contents and display the pages. This has really made life simple :)

Points of interest

Sharing my experience: I have faced a similar situation in one of my projects, where we actually wrote an event handler in the Global.asax page to redirect the user to a standard HTML page, or used the redirect settings of IIS. But then, I came accros this awesome functionality provided by ASP.NET 2.0, and thought of sharing this golden concept with you all :)

Hope this helps! Your comments are always welcome!


  • Version 1.0 of article released on 16 August 08.
  • Version 1.1 of article released on 19 August 08. In this version, I modified the "512 KB" value to "512 bytes". This was a superb comment from one of the readers. Thanks to all readers!


This article, along with any associated source code and files, is licensed under The Common Development and Distribution License (CDDL)


About the Author

Sandeep Aparajit
Software Developer (Senior)
United States United States
Sandeep has 9+ yrs of IT experience. He is Microsoft Certified Technology Specialist and has been certified for Analyzing Requirements and Defining Microsoft .NET Solution Architectures.
He is an active member of:
1. MSDN Forums

My Blog
More Info

You may also be interested in...


Comments and Discussions

QuestionImages in app_offline.htm Pin
BretKnoll25-Jul-12 11:38
memberBretKnoll25-Jul-12 11:38 
AnswerRe: Images in app_offline.htm Pin
BretKnoll26-Jul-12 4:10
memberBretKnoll26-Jul-12 4:10 
GeneralMy vote of 5 Pin
Member 46022478-Oct-11 18:54
memberMember 46022478-Oct-11 18:54 
GeneralEasy to use but has some flaws Pin
aphazel16-Nov-09 1:22
memberaphazel16-Nov-09 1:22 
GeneralNice Tips Pin
Abhijit Jana20-Aug-08 4:11
memberAbhijit Jana20-Aug-08 4:11 
GeneralRe: Nice Tips Pin
Sandeep Aparajit20-Aug-08 12:22
memberSandeep Aparajit20-Aug-08 12:22 
GeneralAwesome Pin
merlin98119-Aug-08 4:09
membermerlin98119-Aug-08 4:09 
GeneralRe: Awesome Pin
Sandeep Aparajit19-Aug-08 6:41
memberSandeep Aparajit19-Aug-08 6:41 
GeneralNot 512KB, File size is only 512 bytes Pin
Gazi Md. Saiful Islam18-Aug-08 18:34
memberGazi Md. Saiful Islam18-Aug-08 18:34 
GeneralRe: Not 512KB, File size is only 512 bytes Pin
Ruchit Surati18-Aug-08 21:05
memberRuchit Surati18-Aug-08 21:05 
GeneralRe: Not 512KB, File size is only 512 bytes Pin
Sandeep Aparajit19-Aug-08 4:42
memberSandeep Aparajit19-Aug-08 4:42 

General General    News News    Suggestion Suggestion    Question Question    Bug Bug    Answer Answer    Joke Joke    Praise Praise    Rant Rant    Admin Admin   

Use Ctrl+Left/Right to switch messages, Ctrl+Up/Down to switch threads, Ctrl+Shift+Left/Right to switch pages.

Permalink | Advertise | Privacy | Terms of Use | Mobile
Web02 | 2.8.171019.1 | Last Updated 17 Aug 2008
Article Copyright 2008 by Sandeep Aparajit
Everything else Copyright © CodeProject, 1999-2017
Layout: fixed | fluid