Click here to Skip to main content
Click here to Skip to main content
Alternative Tip/Trick

Tagged as

Put the website in Maintenance Mode (Under Construction)

, 27 Dec 2011 CPOL
Rate this:
Please Sign up or sign in to vote.
Here is the source code for another solution:Global.asax:void Application_BeginRequest(object sender, EventArgs e){ if (ConfigurationManager.AppSettings["MaintenanceMode"] == "true") { if ((ConfigurationManager.AppSettings["ByPassUrl"].Contains( ...

Here is the source code for another solution:

void Application_BeginRequest(object sender, EventArgs e)
    if (ConfigurationManager.AppSettings["MaintenanceMode"] == "true")
        if ((ConfigurationManager.AppSettings["ByPassUrl"].Contains(
                  HttpContext.Current.Request.UserHostAddress.ToString())) || (Request.IsLocal))

Also, if you want to make the application available for certain IPs (to test the application from different machines or restrict the usage to them only), you may include their IPs in the web config and add this to your code:

<add key="MaintenanceMode" value="true" />
<add key="ByPassUrl" value="" />
//Add list of IP addresses to bypass

from viewing offline page.


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


About the Author

Mukund Thakker
Technical Lead
India India
Tech Lead
MCTS - .NET Framework 4.0, Web Applications
Blog :
Don't code today, what you can't debug tomorrow!
Everything makes sense in someone's mind
Follow on   Twitter

Comments and Discussions

GeneralReason for my vote of 5 good, keep it up. Pinmemberkelvin z3-Jan-12 0:09 
GeneralRe: Thanks Kelvin PinmemberMukund Thakker3-Jan-12 0:14 

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

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

| Advertise | Privacy | Terms of Use | Mobile
Web02 | 2.8.150326.1 | Last Updated 27 Dec 2011
Article Copyright 2011 by Mukund Thakker
Everything else Copyright © CodeProject, 1999-2015
Layout: fixed | fluid