Click here to Skip to main content
15,884,177 members
Articles / Web Development / ASP.NET

Site is Under Maintenance, Please Visit Later: ASP.NET Trick

Rate me:
Please Sign up or sign in to vote.
4.80/5 (3 votes)
8 Jun 2012CPOL2 min read 77.9K   10   6
As a web site owner, we all boast about 24 x 7 uptime. But somewhere down below in our hearts, we know it’s difficult.

24 x 7 Uptime Guaranteed

Image 1

As a web site owner, we all boast about 24 x 7 uptime. But somewhere down below in our hearts, we know it’s difficult. We need to bring down the website for maintenance, fixingdefects, upgrading, etc.

Easy Way…

As an innocent C# ASP.NET developer, you would think how about just stopping IIS web server, do your activity (maintenance, fixing defect, etc.) and then start the IIS again.

Image 2

While this looks to be a but obvious way of solving the problem, it’s not the best way if we consider the end user perspective. The end user would see an ugly screen as shown below leading to more confusion.

Image 3

Rather than end user seeing that kind of absurd screen, how about showing something more better and informative like: “Site is under maintenance and will be live till 3:00 AM”.

Going Offline Graciously:-App_Offline.htm

Also, I would like to highlight here, it’s not about showing the error message but technically we would like to ensure that the following things happen in IIS:-

  • Application domain under which the website is running is brought down.
  • All incoming requests coming to the ASP.NET site need to be stopped.
  • All requests to be routed to the temporary page which is created.
  • After maintenance, the application domain should be loaded and the incoming request should be processed in a normal manner.

Thanks to Microsoft, they always understand our needs. The proper way of approaching this problem is to create a simple “App_offline.htm” file in your application root directory. In this “App_offline.htm”, you can put your user friendly message which the end users can see when the site is under maintenance.

Once done, you can delete the file and your web site app domain is loaded and normal life continues.

Image 4

Image 5

Take a quick look as revision for practical video on "Site is under maintenance"

For further reading do watch the below interview preparation videos and step by step video series.

License

This article, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)


Written By
Architect https://www.questpond.com
India India

Comments and Discussions

 
SuggestionOne more thing to note Pin
hermiodinator18-Jun-12 10:37
hermiodinator18-Jun-12 10:37 
SuggestionBetter Method Pin
MacSpudster14-Jun-12 13:29
professionalMacSpudster14-Jun-12 13:29 
Questionnot reliable Pin
giammin9-Jun-12 1:36
giammin9-Jun-12 1:36 
AnswerRe: not reliable Pin
Shivprasad koirala9-Jun-12 2:46
Shivprasad koirala9-Jun-12 2:46 
Any links for reference. I will update about the same.Thanks for your input.
My book .NET interview questions with 500 mostly asked questions in .NET world .NET Interview questions and answers

GeneralRe: not reliable Pin
giammin9-Jun-12 6:08
giammin9-Jun-12 6:08 
GeneralRe: not reliable Pin
Shivprasad koirala9-Jun-12 16:41
Shivprasad koirala9-Jun-12 16:41 

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.