HttpContext.Server.Transfer to an IHttpHandler

792 views Asked by At

Problem:

I have an application defined within IIS, that points to a path containing a Web App. The Web App has a HttpHandler that handles all incoming requests, and forwards those requests onto other apps (also containing HttpHandlers) located in sub-directories, but not defined as applications in IIS. Essentially:

\
    \bin
        GatewayHandler.dll
        Application1.dll
    \Application1
        Application1Handler.ashx
    GatewayHandler.ashx
    web.config

The GatewayHandler, at the moment simply transfers the request to Application1 as follows:

public void ProcessRequest(HttpContext context)
{
    context.Server.Transfer("Application1/Application1.ashx", true);
}

Yet, running this I get the error:

Error executing child request for Application1/Application1Handler.ashx.

I've looked high and low but from all my searching I cannot find why this would not work. I require all requests to always pass through GatewayHandler.ashx, so I don't wish to use a browser redirect.

Edit: Just to be clear, I'm not transferring from a HttpHandler to an aspx page which works no problem; I'm wanting to transfer from a HttpHandler to another HttpHandler in a sub-directory.

0

There are 0 answers