Maintenance page ASP.NET MVC

Asked

Viewed 355 times

1

I have an ASP.NET MVC site that when it goes into maintenance I need to display a maintenance page, ASP.NET MVC has some possibility to do this just by changing a key on Web.Config or something like?

2 answers

3

Directly, in a ready way, it does not give.

Nothing prevents you from creating a code that takes care said and decide whether you will meet the request made or will show the maintenance page. And nothing prevents you from putting a configuration somewhere that the code reads and determines whether to do it or not. There are countless ways to do this.

I don’t find the web.config suitable, but can sr used. Ideally there should be a signage that the file has been modified to "flip the key" within the application. This avoids the naive way of looking at the file every request that is processed to know what to do.

An example of implementation.

Another approach.

  • I had seen this first approach but could not understand it very well, I will try to take a better look, I thought it was simpler. VLW

  • Is there any way I can do this in a simpler way?

  • ASP.Net had something very simple ready, just put the page in the folder (I think it was offline.html) and it was working. MVC gives you freedom, but requires you to turn around.

  • Good solved in a half-beat but simple way, renaming Global.asax file to anything for the application to stop working. and added an index.hml to the root for it to display.

  • It’s still a way :)

1


I found a solution that is not very elegant but that solved my problem without too much complication.

1º I created an index.html file that is my maintenance page containing the content that should be displayed when the site is out of air.

2nd I put it at the root of my MVC project.

3º When I need to put the site in maintenance I rename the file Global.asax to any other name, like: Globalmanutencao.asax.

I believe that automatically IIS stops looking at this file as the main one and starts looking at index.html..

Thank you.

Browser other questions tagged

You are not signed in. Login or sign up in order to post.