title: How to url redirect/rewrite .asp into .aspx
body: <p>I'm running in the Cassini developer server inside Visual Studio 2012, and I need to redirect clients from the legacy <code>.asp</code> pages to <code>.aspx</code> pages.</p>
  
  <p><strong>Note:</strong> Ideally I would <strong>redirect</strong> clients from <code>.asp</code> to a friendly url, and then internally do a <strong>rewrite</strong> to <code>.aspx</code></p>
  
  <pre><code>POST /ResetClock.asp
  
  HTTP/1.1 307 Temporary Redirect
  Location: //stackoverflow.us/ResetClock
  </code></pre>
  
  <p>And then internally:</p>
  
  <pre><code>POST /ResetClock
  </code></pre>
  
  <p>rewrites into <code>/ResetClock.ashx</code> (Yes, I changed it to <code>.ashx</code>; that's the virtue of url rewriting).</p>
  
  <h1>Like what Hanselman did</h1>
  
  <p>This is a lot like <a href="http://www.hanselman.com/blog/RedirectingASPNETLegacyURLsToExtensionlessWithTheIISRewriteModule.aspx" rel="nofollow">what Scott Hanselman did</a>: </p>
  
  <ul>
  <li>Request for <code>/foo.html</code></li>
  <li>gives the client a redirect to <code>/foo</code></li>
  <li>client request for <code>/foo</code> </li>
  <li>is re-written into <code>/foo.html</code></li>
  </ul>
  
  <h1>The attempted hack</h1>
  
  <p>I tried the hack solution; alter the <code>.asp</code> page to force a redirect to the <code>.ashx</code> (and live to fight with the url re-write syntax another day):</p>
  
  <p><strong>ResetClock.asp</strong></p>
  
  <pre><code>&lt;% 
     Response.Redirect("ResetClock.aspx")
     Response.End 
  %&gt;
  </code></pre>
  
  <p>Except that Cassini does not serve <code>.asp</code> pages at all:</p>
  
  <blockquote>
    <h1>This type of page is not served.</h1>
    
    <p><strong>Description:</strong> The type of page you have requested is not served because it has been explicitly forbidden.  The extension '.asp' may be incorrect.   Please review the URL below and make sure that it is spelled correctly. </p>
    
    <p><strong>Requested URL:</strong> /WebSite/FetchTimes.asp</p>
  </blockquote>
  
  <p>Which points to a related issue. The solution I end up using cannot require anything that isn't already available on the IIS7.5. And it cannot require anything that needs access to the IIS Admin tools; and must exist entirely within the web-site (e.g. the <code>web.config</code>).</p>
  
  <h1>The question</h1>
  
  <p>How do I re-write <code>.asp</code> into something more ASP.net-ish?</p>
  
  <p><strong>Edit</strong>: Changed <code>GET</code> to a <code>POST</code> to thwart nitpickers who wonder why the <code>307 Temporary Redirect</code> and not <code>302 Found</code> or <code>303 See Other</code>.</p>