Redirect site visitors during maintenance

2020-07-23 04:02发布

问题:

I have a site that will be "down" for a few hours while a third party (CC processor) performs maintenance (in other words, the machine will still be online/running). I have already created a maintenance.aspx page. At first, I was going to simply add the new page as the default document in IIS (Server 2003, IIS 6.0), but this still leaves the possibility of someone directly navigating to the real login page.

Is there someway to do a redirect of all pages in a given site to the new maintenance page. Also, the site will be down from 2am-4am, so for extra bonus points, is there a way to automatically do this using the system clock (and prevent me from having to be around for this)?

I am planning on giving an error during login to prevent any access, but I'd rather the users not even be able to make it that far.

Suggestions?

回答1:

Use App_Offline.htm



回答2:

Sounds like you want to use an App_Offline.htm file. Details over here:

http://weblogs.asp.net/scottgu/archive/2005/10/06/426755.aspx

To automate, you would just create a Windows Scheduled Task to move this file in and out of your application's root directory at the desired times.



回答3:

Use a rewriting filter, like IIRF. Configure it to rewrite ALL pages to your maintenance page.

problem solved.



回答4:

app_offline.htm is the way to go indeed. To automatically restore your site, you can simply use a scheduled task.