How to dynamically change part of a link url?
<p>I have a live site (mysite.com) and a dev site (dev.mysite.com) which is an exact copy of the live site.  I am trying to redirect the dev site's absolute links so that I STAY on the dev site.  Currently, of course, clicking those links takes me to the live site- which doesn't help me test. I'm fairly new to asp, but after some research I came up with something for my Global.asax.cs file that I <em>thought</em> would work- but it doesn't. Here's what I tried:</p>

<pre><code>protected void Application_BeginRequest(object sender, EventArgs e)
{
    string url = HttpContext.Current.Request.Url.Host.ToString();
    string endOfPath = Request.RawUrl.ToString();

    if (url.Contains("mysite")) {
        Context.RewritePath("dev.mysite.com" + endOfPath);
    }
} 
</code></pre>

<p>The idea was that if you started at dev.mysite.com clicking a link would automatically insert "dev.mysite.com" onto the front of that link- replacing what was there for an absolute link or just prepending it to a relative link. Either way you'd stay on the dev site.</p>

<p>I get the feeling I'm over-complicating this. Any help would be greatly appreciated.</p>
