Take asp.net web app offline but only for new visitors

badpilot used Ask the Experts™

I understand I can use app_offline.htm to entirely disable an asp.net web app but is there anyway of disabling a site only for new visitors?

I'd like for current visitors to finish off any transactions before the site is disabled for them.

My first thought was to set some value that is checked on session start and if this is enabled or disabled then redirect the user to a page explaining the site is down for maintenance. This value can also be checked on each page load for people who currently have active sessions and then they can be notified that they should finish up what they are doing as the site will be disabled soon. I'm not sure if this is the best approach though and I'm worried about performance having to check this on each page load.

I'd appreciate any suggestions.

Many thanks!
Watch Question

Do more with

Expert Office
EXPERT OFFICE® is a registered trademark of EXPERTS EXCHANGE®
add global.asax in your app, handle the event :-


check for you condition here , say a session["userid"] if its null, redirect to offline page as its new user....


Works perfectly, thanks!

Do more with

Expert Office
Submit tech questions to Ask the Experts™ at any time to receive solutions, advice, and new ideas from leading industry professionals.

Start 7-Day Free Trial