| HOWTO: Prevent MFC ISAPI Extensions from Returning a Default Set of HeadersID: Q238554 
 | 
Unexpected behavior may occur when sending headers from an MFC ISAPI extension. This may be due to the ISAPI Extension sending multiple sets of headers. You can avoid this problem by setting the m_bSendHeaders flag to false in the ISAPI request handler.
The following code will return a "302 object moved" response to a client:
void CSendURLExtension::Default(CHttpServerContext* pCtxt)
{
   char szUrl[] = "http://server/test/ok.htm";
   DWORD dwUrlSize = sizeof(szUrl);
   pCtxt->ServerSupportFunction(HSE_REQ_SEND_URL, (void*)szUrl,
        &dwUrlSize, NULL);
} 
(not all headers are shown)
Client request resource: 
   HTTP: GET Request (from client using port 1524)
      HTTP: Request Method = GET
      HTTP: Uniform Resource Identifier = /isapi/SendURL.dll?<BR/>
      HTTP: Protocol Version = HTTP/1.1
      HTTP: Host = uncle
      HTTP: Connection = Keep-Alive
Server responds:
   HTTP: Response (to client using port 1524)
      HTTP: Protocol Version = HTTP/1.1
      HTTP: Status Code = Found
      HTTP: Reason = Object Moved
      HTTP: Undocumented Header = Location: /ok.htm
   
Server also responds:
   HTTP: Response (to client using port 1524)
      HTTP: Protocol Version = HTTP/1.1
      HTTP: Status Code = OK
      HTTP: Reason = OK
      HTTP: Connection = close 
void CSendURLExtension::Default(CHttpServerContext* pCtxt)
{
        pCtxt->m_bSendHeaders = FALSE;
        char szUrl[] = "http://server/test/ok.htm";
        DWORD dwUrlSize = sizeof(szUrl);
        pCtxt->ServerSupportFunction(HSE_REQ_SEND_URL, (void*)szUrl,
             &dwUrlSize, NULL);
} Q148942 How to Capture Network Traffic with Network Monitor
Q152643 Netmon Does Not Capture Outbound Frames
Additional query words:
Keywords          : kbGrpInetServer kbDSupport 
Version           : 
Platform          : 
Issue type        : kbhowto Last Reviewed: August 9, 1999