开发者

Simple redirect in IIS7 to another page?

开发者 https://www.devze.com 2023-03-14 22:11 出处:网络
We are taking our website offline for approx an hour today and I want to redirect all traffic to an offline default page I created within the folder \"offline\" and the file is default.aspx. I tried u

We are taking our website offline for approx an hour today and I want to redirect all traffic to an offline default page I created within the folder "offline" and the file is default.aspx. I tried using IIS7 HTTPRedirect by checking "Redirect requests to this destination;" and entering in the URL "http://webtest.ipam.ucla.edu/offline" but I am receiving a "Intern开发者_运维技巧et Explorer cannot display webpage" error.

please help.


I'm assuming as you're on IIS7 that your app is in ASP.NET - if not, please ignore this:

There's a nifty little feature that if you place an app_offline.htm file in the root directory of your ASP.NET application, it will have the net effect of taking your application offline.

What is the detail you see in your "Internet Explorer cannot display webpage" error? Is it really that generic or do you get some detail?

Addendum

An alternative is to add something like this into the web.config of your asp.net app (which will allow dynamic pages:

<system.webServer>
    <httpRedirect enabled="true" destination="http://myurl.com/offline.aspx" />
</system.webServer>

The issue with using this approach is while you're uploading new assemblies, there is a chance your application will crash when someone hits it (giving them confusing errors) while you're making changes. Consequently, the offline.aspx page may not show properly - your mileage may vary, but this is why it's generally considered a better practice to use app_offline.htm.

0

精彩评论

暂无评论...
验证码 换一张
取 消