471,354 Members | 2,095 Online
Bytes | Software Development & Data Engineering Community
Post +

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 471,354 software developers and data experts.

redirect entire website in .net?

I need to take my website offline for an hour or so while I perform some
maintenance... is it possible to create a 'catch-all' redirect to a
temporary page (i.e. something in Web.config or global.asax.vb) ?

People access my site through several different pages, so I couldn't put
a redirect on the homepage, and taking my server offline is out the
question.

Thanks,
Peter
--

"I hear ma train a comin'
.... hear freedom comin"
Nov 19 '05 #1
8 2357
Point the default document to another place such as SiteDown.htm
instead of Default.aspx. If you want all pages that are referenced to
go there as well delete the entire directory tree and set the 404 Page
not found to the SiteDown.htm as well. You can do all this by right
clicking on the virtual directory in the iis console.

Endo

Nov 19 '05 #2
You can do this rather simply in IIS.

Select Properties of the web application
Goto Virtual Directory Tab
Change radio button to say "A redirection to a URL"
and put in the URL.

If you don't have access to IIS, you could just stick it in Global.asax.vb
in session:

Sub Application_BeginRequest(ByVal sender As Object, ByVal e As EventArgs)
Response.Redirect("page.aspx")
End Sub

"Stimp" <re*@spumco.com> wrote in message
news:sl****************@carbon.redbrick.dcu.ie...
I need to take my website offline for an hour or so while I perform some
maintenance... is it possible to create a 'catch-all' redirect to a
temporary page (i.e. something in Web.config or global.asax.vb) ?

People access my site through several different pages, so I couldn't put
a redirect on the homepage, and taking my server offline is out the
question.

Thanks,
Peter
--

"I hear ma train a comin'
... hear freedom comin"

Nov 19 '05 #3
If you're using ASP.NET 2.0, all you have to do is place
a file named "app_offline.htm" in your application root directory.

As soon as you do that, ASP.NET 2.0 will shut-down the application,
unload the application domain, and stop processing any new requests
for that application.

ASP.NET will then respond to all requests for the application's
by returning the content of the app_offline.htm file.

If you're using ASP.NET 1.1, what I'd do is unload the application
( in the IIS Manager ), and eliminate the application;s virtual directory.

Then, create a new virtual directory with a default.aspx file
with your "Under Cobstruction" information.

When you're done, dump the under construction app
and reinstate your standard application.

If you have everything prepared, it shgouldn't take
you more than 30 seconds to make the switch.


Juan T. Llibre, ASP.NET MVP
ASP.NET FAQ : http://asp.net.do/faq/
Foros de ASP.NET en Español : http://asp.net.do/foros/
======================================
"Stimp" <re*@spumco.com> wrote in message
news:sl****************@carbon.redbrick.dcu.ie...
I need to take my website offline for an hour or so while I perform some
maintenance... is it possible to create a 'catch-all' redirect to a
temporary page (i.e. something in Web.config or global.asax.vb) ?

People access my site through several different pages, so I couldn't put
a redirect on the homepage, and taking my server offline is out the
question.

Thanks,
Peter
--

"I hear ma train a comin'
... hear freedom comin"

Nov 19 '05 #4
On Thu, 13 Oct 2005 bc******@gmail.com <bc******@gmail.com> wrote:
Point the default document to another place such as SiteDown.htm
instead of Default.aspx. If you want all pages that are referenced to
go there as well delete the entire directory tree and set the 404 Page
not found to the SiteDown.htm as well. You can do all this by right
clicking on the virtual directory in the iis console.


unfortunately I'm using a shared hosting account, so I can't get access
to IIS.

If I contact the support desk to do it, it could be 5 hours before they
respond to put the site back live.

Ah well, I'll write a redirect on every page so.

Thanks.
--

"I hear ma train a comin'
.... hear freedom comin"
Nov 19 '05 #5
On Thu, 13 Oct 2005 Jeff Sheldon <sh******@penn-america.com> wrote:
You can do this rather simply in IIS.

Select Properties of the web application
Goto Virtual Directory Tab
Change radio button to say "A redirection to a URL"
and put in the URL.

If you don't have access to IIS, you could just stick it in Global.asax.vb
in session:

Sub Application_BeginRequest(ByVal sender As Object, ByVal e As EventArgs)
Response.Redirect("page.aspx")
End Sub

that sounds like what I'm looking for. Thanks!

--

"I hear ma train a comin'
.... hear freedom comin"
Nov 19 '05 #6
Very neat solution. Thanks!

I like that!
Although I like the ASP.NET 2.0 solution even more.

;-)


Juan T. Llibre, ASP.NET MVP
ASP.NET FAQ : http://asp.net.do/faq/
Foros de ASP.NET en Español : http://asp.net.do/foros/
======================================
"Jeff Sheldon" <sh******@penn-america.com> wrote in message
news:Oc**************@TK2MSFTNGP14.phx.gbl...
You can do this rather simply in IIS.

Select Properties of the web application
Goto Virtual Directory Tab
Change radio button to say "A redirection to a URL"
and put in the URL.

If you don't have access to IIS, you could just stick it in Global.asax.vb in session:

Sub Application_BeginRequest(ByVal sender As Object, ByVal e As EventArgs)
Response.Redirect("page.aspx")
End Sub

"Stimp" <re*@spumco.com> wrote in message
news:sl****************@carbon.redbrick.dcu.ie...
I need to take my website offline for an hour or so while I perform some
maintenance... is it possible to create a 'catch-all' redirect to a
temporary page (i.e. something in Web.config or global.asax.vb) ?

People access my site through several different pages, so I couldn't put
a redirect on the homepage, and taking my server offline is out the
question.

Thanks,
Peter
--

"I hear ma train a comin'
... hear freedom comin"


Nov 19 '05 #7
Another cute way to do this would be to alter the web.config file to deny all
and use the loginUrl to Sitedown.aspx (or something like that). Doesn't even
require a recompilation:

=-=-=-=-
<!-- AUTHENTICATION
This section sets the authentication policies of the application. Possible
modes are "Windows", "Forms", "Passport" and "None"
-->
<authentication mode="Forms">
<forms loginUrl="sitedown.aspx" protection="All" timeout="30">
</forms>
</authentication>

<authorization>
<deny users="*" />
</authorization>
=-=-=-=-

(I hope this shows up right, I'm still getting used to when you have to use
special characters or not).
--
brians
http://www.limbertech.com
"Stimp" wrote:
I need to take my website offline for an hour or so while I perform some
maintenance... is it possible to create a 'catch-all' redirect to a
temporary page (i.e. something in Web.config or global.asax.vb) ?

People access my site through several different pages, so I couldn't put
a redirect on the homepage, and taking my server offline is out the
question.

Thanks,
Peter
--

"I hear ma train a comin'
.... hear freedom comin"

Nov 19 '05 #8
Good idea, Brian.

I assune you would *not* include login textboxes in sitedown.aspx.

;-)

Juan T. Llibre, ASP.NET MVP
ASP.NET FAQ : http://asp.net.do/faq/
Foros de ASP.NET en Español : http://asp.net.do/foros/
======================================
"brians[MCSD]" <br********@discussions.microsoft.com> wrote in message
news:18**********************************@microsof t.com...
Another cute way to do this would be to alter the web.config file to deny all
and use the loginUrl to Sitedown.aspx (or something like that). Doesn't even
require a recompilation:

=-=-=-=-
<!-- AUTHENTICATION
This section sets the authentication policies of the application. Possible
modes are "Windows", "Forms", "Passport" and "None"
-->
<authentication mode="Forms">
<forms loginUrl="sitedown.aspx" protection="All" timeout="30">
</forms>
</authentication>

<authorization>
<deny users="*" />
</authorization>
=-=-=-=-

(I hope this shows up right, I'm still getting used to when you have to use
special characters or not).
--
brians
http://www.limbertech.com
"Stimp" wrote:
I need to take my website offline for an hour or so while I perform some
maintenance... is it possible to create a 'catch-all' redirect to a
temporary page (i.e. something in Web.config or global.asax.vb) ?

People access my site through several different pages, so I couldn't put
a redirect on the homepage, and taking my server offline is out the
question.

Thanks,
Peter

Nov 19 '05 #9

This discussion thread is closed

Replies have been disabled for this discussion.

Similar topics

2 posts views Thread by Sentinel | last post: by
8 posts views Thread by Victor | last post: by
5 posts views Thread by sck10 | last post: by
56 posts views Thread by UKuser | last post: by
3 posts views Thread by ykhamitkar | last post: by
reply views Thread by XIAOLAOHU | last post: by

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.