SetHeader Method  

Create or change the value of a response header for the client session.


object.SetHeader( ClientId, HeaderName, HeaderValue )


An integer that identifies the client session.
A string that specifies the name of the header field. Header names are not case-sensitive and should not include the colon which acts as a delimiter that separates the header name from its value.
A string variable that contains the new value of the response header.

Return Value

A Boolean value that specifies if the method was successful.


The SetHeader method will change the value of a response header for the specified client session, typically within an OnCommand event handler. If the HeaderName value matches an existing header field, its value will be replaced. If the header name is not defined, then a new header will be created with the given value. You should not change the value of most standard response header values unless you are certain of the impact that it would have on the normal operation of the client.

If you wish to define a custom header value that would be included in the response to a client request, you should prefix the header name with "X-" to avoid potential conflicts with the standard response headers. For example, if you wanted to identify a customer, you could create a header field with the name "X-Customer-ID" and set the value to the customer ID number. The client application would receive this custom header value as part of the response to its request for a document.

Refer to Hypertext Transfer Protocol Headers for a list of common request and response headers that are used.

See Also

GetAllHeaders Method, GetHeader Method, OnCommand Event