custom httphandler throwing exception while doing rewrite path
<p>I want redirect to a file which is at the root level of the application , but i am getting the following error.</p>

<p>I did the following things to achieve the same</p>

<ol>
<li>I have a virtual directory under root which is sample</li>
<li>Added handler with some  custom name like  .zpy which resolves to .net
root/sample(sample is a virtual directory)</li>
<li><p>Added the mapping in the web.config </p>

<pre><code>&lt;add verb="*" path="*.zpy" type="MyUrlHttpHandler, WebProj"/&gt;
</code></pre></li>
<li><p>And this is the code</p>

<pre><code>string finalUrl= "http://www.test.com/test.asp";
context.RewritePath(finalUrl);
IHttpHandler hnd = PageParser.GetCompiledPageInstance(finalUrl, null, context);
hnd.ProcessRequest(context);
</code></pre></li>
</ol>

<p>I get the following error </p>

<p><strong>http://www.test.com/test.asp is not a valid virtual path.</strong></p>

<p>The code is getting executed but i am unable to send the request to test.asp which is at
root level.</p>

<p>i tried moving the handler to root  and having handler at the root level , but its still throwing the same error</p>

<p>exception stack trace</p>

<pre><code>HttpException (0x80004005): 'http://locwww.test.com/test.asp' is not a valid virtual path.]
   System.Web.VirtualPath.Create(String virtualPath, VirtualPathOptions options) +8855691
   System.Web.HttpContext.RewritePath(String path, Boolean rebaseClientPath) +116
   System.Web.HttpContext.RewritePath(String path) +6
   ADC.Web.Code.ApcUrlHttpHandler.ProcessRequest(HttpContext context) in C:\Projects\webproj\urlHttpHandler.cs:30
   System.Web.CallHandlerExecutionStep.System.Web.HttpApplication.IExecutionStep.Execute() +181
   System.Web.HttpApplication.ExecuteStep(IExecutionStep step, Boolean&amp; completedSynchronously) +75
</code></pre>
