title: 'The application relative virtual path '~/' is not allowed here' in unit test on 2K3 build server but not XP/Vista dev machines
body: <p>I'm mocking out HttpRequestBase so I can create an HtmlHelper in test code and write tests around HtmlHelper extension methods. I do this as part of the setup code:</p>
  
  <pre><code>httpRequestBase.Stub(h =&gt; h.ApplicationPath).Return("~/");
  httpRequestBase.Stub(h =&gt; h.AppRelativeCurrentExecutionFilePath).Return(appPath);
  httpRequestBase.Stub(h =&gt; h.PathInfo).Return("");
  </code></pre>
  
  <p>which on two dev machines (one running XP, one Vista 64-bit) works fine. However, on a Windows Server 2003 build machine the test fails when I call RouteLink() on the HtmlHelper, like this:</p>
  
  <p>System.ArgumentException : The application relative virtual path '~/' is not allowed here.
  at System.Web.VirtualPath.Create(String virtualPath, VirtualPathOptions options)</p>
  
  <p>In both cases I'm using NUnit 2.4.8 and the NUnit GUI as the test runner. Everything else is identical except the OS as far as I can tell: same version of RhinoMocks (3.5), same version of ASP.NET MVC (RTM). I tried copying the binaries across from a dev machine rather than using the ones on the build machine, and it makes no difference.</p>
  
  <p>When I change the first line in the setup code to this:</p>
  
  <pre><code>httpRequestBase.Stub(h =&gt; h.ApplicationPath).Return("/");
  </code></pre>
  
  <p>the test passes on all machines.</p>
  
  <p>Any idea why?</p>