Click here to Skip to main content
13,451,731 members (45,521 online)
Click here to Skip to main content
Add your own
alternative version

Tagged as


4 bookmarked
Posted 27 Dec 2011

Put the website in Maintenance Mode (Under Construction)

, 27 Dec 2011
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
Project 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

You may also be interested in...

Comments and Discussions

GeneralReason for my vote of 5 good, keep it up. Pin
kelvin z2-Jan-12 23:09
memberkelvin z2-Jan-12 23:09 
GeneralRe: Thanks Kelvin Pin
Mukund Thakker2-Jan-12 23:14
memberMukund Thakker2-Jan-12 23:14 

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.

Permalink | Advertise | Privacy | Terms of Use | Mobile
Web01-2016 | 2.8.180318.3 | Last Updated 27 Dec 2011
Article Copyright 2011 by Mukund Thakker
Everything else Copyright © CodeProject, 1999-2018
Layout: fixed | fluid