"Site is under construction" page for asp.net site

15,181

Solution 1

I prefer App_Offline.htm file in the root.

Take a scrape of your site template, stick it in the App_Offline.htm file and place a message in it. Just dropping this file in the root folder of your web site effectively disables your site.

Meanwhile, upload/manage a second instance of the web-site using a temporary domain/URL and when tested/ready, re-point the old site to the new site in IIS.

Solution 2

The change you're deploying now is a simple change to a single page. But sometimes you deploy larger changes, or you deploy both code and database changes, and the site might behave incorrectly if a user requests a page before deployment is finished. To prevent users from accessing the site while deployment is in progress, you can use an app_offline.htm file. When you put a file named app_offline.htm in the root folder of your application, IIS automatically displays that file instead of running your application. So to prevent access during deployment, you put app_offline.htm in the root folder, run the deployment process, and then remove app_offline.htm after successful deployment.

Source: https://www.asp.net/mvc/overview/deployment/visual-studio-web-deployment/deploying-a-code-update

Share:
15,181
iburlakov
Author by

iburlakov

.net developer

Updated on July 30, 2022

Comments

  • iburlakov
    iburlakov almost 2 years

    I have to implement ability to show "site is under construction" page during doing some maintenance work on site. There are a lot of ways to implement such behavior (using global.asax file, using IIS and so on). So I would like to know waht is the most used ways of impletenting this feature.

    Thanks in advance.