Connecting Tech Pros Worldwide Help | Site Map

Catch All Redirect

  #1  
Old June 25th, 2009, 02:54 PM
Familiar Sight
 
Join Date: Jul 2007
Posts: 180
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?
  #2  
Old June 25th, 2009, 02:56 PM
insertAlias's Avatar
Forum Leader
 
Join Date: Apr 2008
Location: San Antonio, TX (USA)
Posts: 2,569

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");
  #3  
Old June 25th, 2009, 02:57 PM
Familiar Sight
 
Join Date: Jul 2007
Posts: 180

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?
  #4  
Old June 25th, 2009, 03:05 PM
insertAlias's Avatar
Forum Leader
 
Join Date: Apr 2008
Location: San Antonio, TX (USA)
Posts: 2,569

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.
  #5  
Old June 29th, 2009, 08:14 PM
Familiar Sight
 
Join Date: Jul 2007
Posts: 180

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.
  #6  
Old June 29th, 2009, 08:42 PM
insertAlias's Avatar
Forum Leader
 
Join Date: Apr 2008
Location: San Antonio, TX (USA)
Posts: 2,569

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


Similar Threads
Thread Thread Starter Forum Replies Last Post
htaccess redirect every request to root? catch all.. hsriat answers 3 September 15th, 2009 08:21 PM
How to catch all exceptions? K Viltersten answers 4 September 23rd, 2008 06:55 PM
301 redirect like .htaccess Stuart Palmer answers 0 July 24th, 2006 02:05 PM
redirect entire website in .net? Stimp answers 8 November 19th, 2005 09:06 PM