Share via


Sys.Net.WebRequest headers Property

Gets the HTTP headers for the Sys.Net.WebRequest instance.

var headers = MyWebRequest.get_headers();

Return Value

A dictionary of name/value pairs that contains the HTTP headers that are sent with the Web request.

Remarks

The headers property method returns a dictionary that you can use to set custom headers. If there are no custom headers currently associated with the Web request, an empty dictionary is returned. You can use the returned dictionary to set your custom header values.

Example

The following example shows how to use the HTTP headers. This code is part of a complete example found in the WebRequest class overview.

See Also

Reference

Sys.Net.WebRequestManager Class

Sys.Net.WebRequestExecutor Class

Sys.Net.XMLHttpExecutor Class