title: Using Context.RewritePath to rewrite to a different-domain
body: <p>this is my first post on SO. :) My goal is, in the application (which is an existing VB.NET app <em>shudder</em>), whenever a request is encountered for a resource such as:</p>
  
  <pre><code>/itemimages/image.png
  </code></pre>
  
  <p>That it gets rewritten to</p>
  
  <pre><code>http://example.com/itemimages/image.png
  </code></pre>
  
  <p>There are 10GB of images on the production site so for local development, we just want to rewrite the request so we don't have to download and shuffle around 10GB of product images.</p>
  
  <p>I've tried the following in Application_BeginRequest() keep in mind I'm simplifying this to illustrate the problem I'm running into:</p>
  
  <pre><code>If (url1.IndexOf("itemimages") &gt; 0) Then
      Dim app As HttpApplication = CType(sender, HttpApplication)
      app.Context.RewritePath("https://www.google.com/images/srpr/logo3w.png")
  End If
  </code></pre>
  
  <p>The error I get is:</p>
  
  <blockquote>
    <p>'https:/www.google.com/images/srpr/logo3w.png' is not a valid virtual path.</p>
  </blockquote>
  
  <p>Note the single forward slash in https:/www.google.com, even though I specified two slashes. Plus, it explicitly mentions that it's not a valid VIRTUAL path so apparently I can't specify an absolute URL here.</p>
  
  <p>How can I rewrite requests to "/itemimages/image.png" to "http://www.website.com/itemimages/image.png"? I'm posting this in C# also because I'm more comfortable with that language anyways and can probably convert any solution between the two pretty easily.</p>