views:

55

answers:

1

Hi all,
I want to replace an old ISAPI filter that ran on IIS6. This filter checks if the request is of a special kind, then manipulates the header and continues with the request. Two headers are added in the manipulating method that I need for calling another special ISAPI module.
So I have ISAPI C++ code like:

DWORD OnPreProc(HTTP_FILTER_CONTEXT *pfc, HTTP_FILTER_PREPROC_HEADERS *pHeaders)
{
    if (ManipulateHeaderInSomeWay(pfc, pHeaders))
    {
        return SF_STATUS_REQ_NEXT_NOTIFICATION;
    }
    return SF_STATUS_REQ_FINISHED;
}

I now want to rewrite this ISAPI filter as a managed module for the IIS7. So I have something like this:

private void OnMapRequestHandler(HttpContext context)
{
    ManipulateHeaderInSomeWay(context);
}

And now what? The request seems not to do what it should?
I already wrote an IIS7 native module that implements the same method. But this method has a return value with which I can tell what to do next:

REQUEST_NOTIFICATION_STATUS CMyModule::OnMapRequestHandler(IN IHttpContext *pHttpContext, OUT IMapHandlerProvider *pProvider)
{
    if (DoSomething(pHttpContext))
    {
        return RQ_NOTIFICATION_CONTINUE;
    }
    return RQ_NOTIFICATION_FINISH_REQUEST;
}

So is there a way to send my manipulated context again?

A: 

I finally found it. As I stated in the comments I add two headers to the request that are needed by my DLL that finally handles the request. The url header contains the path to the DLL. So I have to do a redirect to that DLL.
This is done with the following code:

private void OnMapRequestHandler(HttpContext context)
{
    ManipulateHeaderInSomeWay(context);
    string url = context.Request.Header["url"]; // path of the DLL

    // now this is the important call!
    context.Server.TransferRequest(url, true);
}
Simon Linder