Connecting Tech Pros Worldwide Forums | Help | Site Map

Catch All Redirect

Familiar Sight
 
Join Date: Jul 2007
Posts: 182
#1: Jun 25 '09
We host personalized websites that are generated on the fly on a per campaign basis. Currently, when a campaign is over, we simply take down the site. Now, we are looking to have any post-campaign visitors directed to a generic page, "sorry we missed you..." Typically we will setup a subdomain for each campaign, something like subdomain.domain.com/firstname.lastname, so how can I get all of those personalized sites to direct to subdomain.domain.com/missed.aspx?

insertAlias's Avatar
Forum Leader
 
Join Date: Apr 2008
Location: San Antonio, TX (USA)
Posts: 2,695
#2: Jun 25 '09

re: Catch All Redirect


Just put a Response.Redirect in your default page's Page_Load method.

Example in C#:
Expand|Select|Wrap|Line Numbers
  1. Response.Redirect("http://bytes.com");
Familiar Sight
 
Join Date: Jul 2007
Posts: 182
#3: Jun 25 '09

re: Catch All Redirect


Are you saying that I would take down the original page, and just replace it with a page containing a simple redirect such as this?
insertAlias's Avatar
Forum Leader
 
Join Date: Apr 2008
Location: San Antonio, TX (USA)
Posts: 2,695
#4: Jun 25 '09

re: Catch All Redirect


You don't even really have to take it down, you could just add that line as the first line of code in the Page_Load method.

Or you could put a tag like this in the <head> section of your HTML:
Expand|Select|Wrap|Line Numbers
  1. <META http-equiv="refresh" content="0;URL=http://bytes.com"> 
Either way it is up to you.

I'm sure that there is a way to configure IIS to do the redirects for you, but I'm not an expert there.
Familiar Sight
 
Join Date: Jul 2007
Posts: 182
#5: Jun 29 '09

re: Catch All Redirect


Quote:

Originally Posted by insertAlias View Post

You don't even really have to take it down, you could just add that line as the first line of code in the Page_Load method.

Or you could put a tag like this in the <head> section of your HTML:

Expand|Select|Wrap|Line Numbers
  1. <META http-equiv="refresh" content="0;URL=http://bytes.com"> 
Either way it is up to you.

I'm sure that there is a way to configure IIS to do the redirects for you, but I'm not an expert there.

This would be a way to redirect pages that exist, but what about pages that do not exist(404 errors). Given these are personalized pages that are generated on the fly, how would I handle those best?

Note-
I have attempted to setup web.config custom error pages for 404 errors, but redirects are not working properly. I have head that this method of redirects is very inconsistant.
insertAlias's Avatar
Forum Leader
 
Join Date: Apr 2008
Location: San Antonio, TX (USA)
Posts: 2,695
#6: Jun 29 '09

re: Catch All Redirect


Well, if you go into IIS, you can check the properties of a site, and set the custom error pages there. Maybe that will work for you.
Reply