AddResponseHeaders Callback Function

The AddResponseHeaders callback function adds a header to the HTTP response, if the response was created by Forefront TMG.

The AddResponseHeaders callback function is declared as:


BOOL WINAPI * AddResponseHeaders(
  __in  struct _HTTP_FILTER_CONTEXT* pfc,
  __in  LPSTR lpszHeaders,
  __in  LPSTR dwReserved



Pointer to the HTTP_FILTER_CONTEXT data structure that is associated with the current, active HTTP session. Pass the filter context in this parameter.


Pointer to a null-terminated string containing a string that contains the headers to add. The string should be in the following format:


The string may contain one or more headers. Each header and value pair must be terminated by "\r\n".


Reserved for future use. This must be zero.

Return Value

This callback function returns TRUE if the call is successful; otherwise, it returns FALSE. To obtain extended error information, call GetLastError, which may return one of the following Windows system error codes:


The header was successfully added. This error code is returned when the callback function returns TRUE.


The value specified in the lpszValue parameter is invalid.


Not enough memory was available to complete the requested operation.


The AddResponseHeaders callback function can be used to add headers to responses for clients before the server processes the request, but not during or after SF_NOTIFY_ACCESS_DENIED or SF_NOTIFY_SEND_RESPONSE notifications. You can add a header when the SF_NOTIFY_SEND_RESPONSE notification occurs by using the AddHeader member of the HTTP_FILTER_SEND_RESPONSE structure.

Headers are added by AddResponseHeaders only for responses generated by Forefront TMG, such as error pages, where SF_NOTIFY_SEND_RESPONSE is triggered. Use SF_NOTIFY_SEND_RAW_DATA to add headers to all responses. For more information about the types of event notifications that are sent to Web filters, see Event Notifications.


Server Requires Windows Server 2008.
Version Requires Forefront Threat Management Gateway (TMG).

Declared in Wpxhttpfilt.h.


Requires W3Filter.dll.

See Also

Callback Functions

Send comments about this topic to Microsoft

Build date: 11/30/2009

© 2008 Microsoft Corporation. All rights reserved.