Partager via


AddResponseHeaders Function

The AddResponseHeaders callback function specifies a response header for IIS to send to the client.

BOOL WINAPI * AddResponseHeaders(
   PHTTP_FILTER_CONTEXT pfc,
   LPSTR lpszHeaders,
   LPSTR dwReserved
);

Parameters

  • pfc
    Points to the HTTP_FILTER_CONTEXT Structure data structure that is associated with the current, active HTTP transaction.

  • lpszHeaders
    Points to a string that contains the headers to add. The string should be in the following format:

    header:value\r\n
    
  • dwReserved
    Reserved for future use. This must be zero.

Return Values

Returns true if the function was successful; otherwise false. The GetLastError function indicates the reason for failure. The most common reason is as follows:

Return code

Description

ERROR_INVALID_PARAMETER

If pfc or the server context that pfc points to is invalid. Additionally, if the header name does not end with a colon (:).

Remarks

AddResponseHeaders() can be used to add headers for client before the server processes the request, but not during or after HTTP_FILTER_SEND_RESPONSE notification. If you need to add a header when the HTTP_FILTER_SEND_RESPONSE notification occurs, you can do so by using the AddHeader member of the HTTP_FILTER_SEND_RESPONSE Structure structure.

Requirements

Client: Requires Windows XP Professional, Windows 2000 Professional, or Windows NT Workstation 4.0.

Server: Requires Windows Server 2003, Windows 2000 Server, or Windows NT Server 4.0.

Product: IIS

Header: Declared in httpfilt.h.