Go Back   Velocity Reviews > Newsgroups > ASP Net
User Name
Password
Register FAQ Members List Calendar Search Today's Posts Mark Forums Read

Reply

ASP Net - Advanced redirect

 
Thread Tools Search this Thread
Old 08-13-2007, 05:00 AM   #1
Default Advanced redirect


In the transition of a website from one domain to another for exmaple
from www.oldsite.com to www.newsite.com I need to "rewrite" the URL so
all links to the old site will be linked to the new site as follows:
1. For URLs that reference pages:
Change http://www.oldsite.com/dir1/content/...aspx?p1=1&p2=2
into http://www.newsite.com/dir1/content/...aspx?p1=1&p2=2
2. For URLs that reference sub domains:
Change http://subdomain.oldsite.com to http://subdomain.newsite.com
3. For URLs that reference sub folders
change http://www.oldsite.com/sub1
to http://www.newsite.com/sub1
How can it be done?
If it can be done with RewritePath method of HTTPContext, can someone
show me simple code?
Thanks



myalo
  Reply With Quote
Old 08-13-2007, 06:07 AM   #2
Scott M.
 
Posts: n/a
Default Re: Advanced redirect
Find & Replace?


"myalo" <> wrote in message
news: oups.com...
> In the transition of a website from one domain to another for exmaple
> from www.oldsite.com to www.newsite.com I need to "rewrite" the URL so
> all links to the old site will be linked to the new site as follows:
> 1. For URLs that reference pages:
> Change http://www.oldsite.com/dir1/content/...aspx?p1=1&p2=2
> into http://www.newsite.com/dir1/content/...aspx?p1=1&p2=2
> 2. For URLs that reference sub domains:
> Change http://subdomain.oldsite.com to http://subdomain.newsite.com
> 3. For URLs that reference sub folders
> change http://www.oldsite.com/sub1
> to http://www.newsite.com/sub1
> How can it be done?
> If it can be done with RewritePath method of HTTPContext, can someone
> show me simple code?
> Thanks
>





Scott M.
  Reply With Quote
Old 08-13-2007, 09:13 PM   #3
myalo
 
Posts: n/a
Default Re: Advanced redirect
On Aug 12, 10:07 pm, "Scott M." <s-...@nospam.nospam> wrote:
> Find & Replace?
>

I tested that and could not get it work. As I understand (unless I am
missing something here) HTTPContext.RewritePath can change the
"internal path" only such as http://www.oldsite.com/product1 to
http://www.oldsite.com/products.aspx?id=1. It cannot change it to
http://www.newsite.com/product1. Is there a way to change the URL
itself and not only the internal path?
I can use redirect but that gets tricky. When I tried it I got into a
loop as the redirection triggered the handler again and again. I might
be doing something wrong.
Do you have any idea how can do that?
Thanks
Moshe



myalo
  Reply With Quote
Old 08-13-2007, 09:26 PM   #4
George Ter-Saakov
 
Posts: n/a
Default Re: Advanced redirect
The RewritePath only works within application. You can not rewrite path to
different URL than the one that is "belongs" to the application.

Hence you can not Rewrite it to different domain name. Response.Redirect
should work just fine.
Why do you redirect to the http://www.newsite.com/product1

Your newsite.com should do the Rewrite to /products.aspx?id=1


George.


"myalo" <> wrote in message
news: ups.com...
> On Aug 12, 10:07 pm, "Scott M." <s-...@nospam.nospam> wrote:
>> Find & Replace?
>>

> I tested that and could not get it work. As I understand (unless I am
> missing something here) HTTPContext.RewritePath can change the
> "internal path" only such as http://www.oldsite.com/product1 to
> http://www.oldsite.com/products.aspx?id=1. It cannot change it to
> http://www.newsite.com/product1. Is there a way to change the URL
> itself and not only the internal path?
> I can use redirect but that gets tricky. When I tried it I got into a
> loop as the redirection triggered the handler again and again. I might
> be doing something wrong.
> Do you have any idea how can do that?
> Thanks
> Moshe
>





George Ter-Saakov
  Reply With Quote
Old 08-14-2007, 05:49 PM   #5
Scott M.
 
Posts: n/a
Default Re: Advanced redirect

"myalo" <> wrote in message
news: ups.com...
> On Aug 12, 10:07 pm, "Scott M." <s-...@nospam.nospam> wrote:
>> Find & Replace?
>>

> I tested that and could not get it work. As I understand (unless I am
> missing something here) HTTPContext.RewritePath can change the
> "internal path" only such as http://www.oldsite.com/product1 to
> http://www.oldsite.com/products.aspx?id=1. It cannot change it to
> http://www.newsite.com/product1. Is there a way to change the URL
> itself and not only the internal path?
> I can use redirect but that gets tricky. When I tried it I got into a
> loop as the redirection triggered the handler again and again. I might
> be doing something wrong.
> Do you have any idea how can do that?
> Thanks
> Moshe



I say again... Find & Replace?




Scott M.
  Reply With Quote
Reply


Thread Tools Search this Thread
Search this Thread:

Advanced Search

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

vB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are Off
Pingbacks are Off
Refbacks are Off

Similar Threads
Thread Thread Starter Forum Replies Last Post
Xclio Godspeed One Advanced PC Case Admin Front Page News 0 07-30-2009 09:54 PM
Looking for an advanced FTP client software jeniffer_key Software 2 03-02-2008 03:51 PM
eBay Users Targeted By Advanced Trojan ufo DVD Video 2 03-07-2007 04:13 AM
Cisco Redirect widi71 Hardware 0 11-14-2006 06:39 PM
Passion Of The Christ Advanced Screening DVD Review @ GENRE ONLINE.NET! Writer R5 DVD Video 78 08-31-2004 02:40 PM




SEO by vBSEO 3.3.2 ©2009, Crawlability, Inc.

1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46