I want to redirect the user to a URL that will actually be exactly the same
URL on the same site, but with a different Domain.
For example, let's say the page where the user currently resides is
http://DomainA.com/SomeFolder/Default.aspx
and I want to redirect the user automatically to whatever their current path
is on the site, but with a different domain:
http://DomainB.com/SomeFolder/Default.aspx
DomainA.com and DomainB.com are actually the same server/IP, but I want to
send the user through Response.Redirect() to that second domain.
I have no problem reading the current Host, Port, etc. from the Request.Url
object. But my problem is, let's say I want to send the user to a different
place on the site too. For example, I want them to be on a different domain
AND a to go to a path that would normally be done just be writing
Response.Redirect("~/Something/XYZ.aspx")
The problem is, I don't seem to be able to figure out how to properly BUILD
the path AND switch to a different DOMAIN into a single new URL.
Help?
Alex
Walter Wang [MSFT] - 18 Feb 2008 01:48 GMT
Hi Alex,
If my understanding is correct, the key issue here is how can we know the
aplication root name represented by the "~" symbol.
Please see if following code helps:
Request.Url.GetLeftPart(UriPartial.Scheme) + "DomainB" +
Request.ApplicationPath + "Something/XYZ.aspx"
Regards,
Walter Wang (wawang@online.microsoft.com, remove 'online.')
Microsoft Online Community Support
==================================================
When responding to posts, please "Reply to Group" via your newsreader so
that others may learn and benefit from your issue.
==================================================
This posting is provided "AS IS" with no warranties, and confers no rights.