I have an ASP.NET MVC site that when I go into maintenance I need to display a maintenance page, does ASP.NET MVC have any chance of doing this just by changing a key in Web.Config
or something like this?
I have an ASP.NET MVC site that when I go into maintenance I need to display a maintenance page, does ASP.NET MVC have any chance of doing this just by changing a key in Web.Config
or something like this?
I found a solution that is not very elegant but that solved my problem without much complication.
1st I created an index.html file that is my maintenance page containing the content that should be displayed when the site is off the air.
2º I put it in the root of my MVC project.
3º When I need to put the site under maintenance I rename the Global.asax file to any other name, type: GlobalManutencao.asax.
I believe that IIS automatically stops looking at this file as main and starts looking at the index.html.
Thank you.
Directly, promptly, it does not.
Nothing prevents you from creating a code that you care about and decides whether to fulfill the requested request or will display the maintenance page. Nothing prevents you from putting a configuration somewhere that the code reads and determines whether to do this or not. There are many ways to do this.
I do not think%% adequate, but you can use it. Ideally there should be a sign that the file has been modified to "flip the key" inside the application. This avoids the naive way of looking as the file is every request that is processed to know what to do.