To work around this problem, use one of these methods as
detailed following this list:
- Use Response.Redirect.
- Add the Context.Rewrite path
Use Response.Redirect
Use
Response.Redirect instead of
Server.Transfer or
context.Server.Execute in the
ProcessRequest() method of
HttpHandler.
The modified
ProcessRequest() method appears as follows:
Microsoft Visual C# .NET Code
public void ProcessRequest(HttpContext context)
{
HttpRequest Request = context.Request;
HttpResponse Response = context.Response;
string redirurl = Request.RawUrl.Replace ("test.ashx/", "");
context.RewritePath (redirurl);
Response.Redirect(redirurl);
}
Microsoft Visual Basic .NET Code
Public Sub ProcessRequest(ByVal context As HttpContext) _
Implements IHttpHandler.ProcessRequest
Dim Request As HttpRequest = context.Request
Dim Response As HttpResponse = context.Response
Dim redirurl As String = Request.RawUrl.Replace("test.ashx/", "")
context.RewritePath(redirurl)
Response.Redirect(redirurl)
End Sub
Add Context.Rewrite
Add the
Context.Rewrite path in
Application_BeginRequest event of the Global.asax file.
The modified
Application_BeginRequest event appears as as follows:.
Visual C# .NET Code
protected void Application_BeginRequest(Object sender, EventArgs e)
{
string redirurl = Request.RawUrl.Replace ("test.ashx/", "");
this.Context.RewritePath(redirurl);
}
Visual Basic .NET Code
Sub Application_BeginRequest(ByVal sender As Object, ByVal e As EventArgs)
Dim redirurl As String
redirurl = Request.RawUrl.Replace("test.ashx/", "")
Me.Context.RewritePath(redirurl)
End Sub