WebBrowser SetDefaultHeader Method (String)C# API
Sets a default HTTP request header for every subsequent Request object created by this WebBrowser, using the contents of the specified string.

Namespace: Facilita.Web
Assembly: clrWebBrowser (in clrWebBrowser.dll) Version: 9.5.7.98 (1.0.0.0)
Syntax

public virtual void SetDefaultHeader(
	string header
)

Parameters

header
Type: System String
The full header to set.
Remarks

This method is useful if there is a particular HTTP header that is required in every HTTP request by a particular application.
Examples

The following example demonstrates setting the "Accept-Language: en-GB" HTTP header for every subsequent request created.
// Set the "Accept-Language: en-GB" HTTP header for EVERY subsequent request 
WebBrowser.SetDefaultHeader("Accept-Language: en-GB");

// Create a request
Request request = WebBrowser.CreateRequest(HttpMethod.GET, new Url("http://www.testplant.co.uk/"));

// Override the "Accept-Language" header for this request ONLY
request.SetHeader("Accept-Language: en-US"); 

Response response = request.Send(); 

// Subsequent requests will still use the "Accept-Language: en-GB" HTTP header
See Also