DotNetBrowser
1.21.5
|
Interface for handling URL requests and responses. More...
Inherited by DotNetBrowser.DefaultNetworkDelegate.
Public Member Functions | |
void | OnBeforeURLRequest (BeforeURLRequestParams parameters) |
Fires when a request is about to occur. This event is sent before any TCP connection is made and can be used to redirect requests to another location. This method is invoked synchronously. URL request will be blocked while this method is executing. If this method throws an exception, then default behavior will be used - the target URL will not be changed. More... | |
void | OnBeforeRedirect (BeforeRedirectParams parameters) |
Fired when a server-initiated redirect is about to occur. This method is invoked synchronously. URL request will be blocked while this method is executing. If this method throws an exception, the loading process will not be affected. More... | |
void | OnBeforeSendHeaders (BeforeSendHeadersParams parameters) |
Fires when a request is about to occur and the initial headers have been prepared. It allows adding, modifying, and deleting HTTP request headers. This method is invoked synchronously. URL request will be blocked while this method is executing. If this method throws an exception, the loading process will not be affected. More... | |
void | OnSendHeaders (SendHeadersParams parameters) |
Fires right before the HTTP headers are sent to the network. This event is informational and it does not allow modifying HTTP headers. This method is invoked synchronously. URL request will be blocked while this method is executing. If this method throws an exception, the loading process will not be affected. More... | |
void | OnHeadersReceived (HeadersReceivedParams parameters) |
Fires each time that an HTTP(S) response header is received. Due to redirects and authentication requests this can happen multiple times per request. This event is intended to allow adding, modifying, and deleting HTTP response headers, such as incoming "Set-Cookie" headers. More... | |
void | OnResponseStarted (ResponseStartedParams parameters) |
Fires when the first byte of the response body is received. For HTTP requests, this means that the status line and response headers are available. This event is informational. More... | |
void | OnDataReceived (DataReceivedParams parameters) |
This method is invoked each time when a part of the response body is received. When the whole response body is received, OnCompleted(RequestCompletedParams) method will be fired. This event is informational. More... | |
void | OnCompleted (RequestCompletedParams parameters) |
Fires when a request has been processed successfully or failed. You can get information about HTTP request status via the RequestCompletedParams.GetStatus() method. If HTTP request status is RequestStatus.FAILED, you can get information about network error using the RequestCompletedParams.GetErrorCode() method. More... | |
void | OnDestroyed (RequestParams parameters) |
Fires when a request is being destroyed. More... | |
bool | OnAuthRequired (AuthRequiredParams parameters) |
This method is invoked when a request receives an authentication challenge and is unable to respond using cached credentials. You can use this method to handle "basic" or "digest" authentication. FYI: to test "basic" or "digest" authentication you can use http://test.webdav.org/ More... | |
bool | OnCanSetCookies (string url, List< Cookie > cookies) |
This method is invoked when Chromium engine decides whether cookies can be saved for the url or not. Return true to allow engine to save the cookies. If you return false, the cookies will not be saved and will not be available in CookieStorage. More... | |
bool | OnCanGetCookies (string url, List< Cookie > cookies) |
This method is invoked when Chromium engine decides whether cookies can be sent back to the web server. Return true to allow cookies to be sent to the web server. More... | |
void | OnBeforeSendProxyHeaders (BeforeSendProxyHeadersParams parameters) |
The similar to OnBeforeSendHeaders(BeforeSendHeadersParams) method. Fires when proxy connection is used, after OnBeforeSendHeaders method is invoked. Provides information about proxy connection, and also allows adding, modifying, and deleting HTTP request headers. More... | |
void | OnPacScriptError (PacScriptErrorParams pacScriptErrorParams) |
This method is invoked when Chromium proxy resolver failed to parse PAC script file to extract proxy settings. More... | |
Interface for handling URL requests and responses.
bool DotNetBrowser.NetworkDelegate.OnAuthRequired | ( | AuthRequiredParams | parameters | ) |
This method is invoked when a request receives an authentication challenge and is unable to respond using cached credentials. You can use this method to handle "basic" or "digest" authentication. FYI: to test "basic" or "digest" authentication you can use http://test.webdav.org/
parameters | the authentication challenge information such as authentication scheme, URL etc. Use AuthRequiredParams.Username and AuthRequiredParams.Password to provide authentication credentials. |
Implemented in DotNetBrowser.DefaultNetworkDelegate, DotNetBrowser.WinForms.WinFormsDefaultNetworkDelegate, and DotNetBrowser.WPF.WPFDefaultNetworkDelegate.
void DotNetBrowser.NetworkDelegate.OnBeforeRedirect | ( | BeforeRedirectParams | parameters | ) |
Fired when a server-initiated redirect is about to occur. This method is invoked synchronously. URL request will be blocked while this method is executing. If this method throws an exception, the loading process will not be affected.
parameters | provides information about the current URL, new URL, HTTP method ("GET", "POST" etc.) and HTTP response code (e.g., 200, 404, and so on). |
Implemented in DotNetBrowser.DefaultNetworkDelegate.
void DotNetBrowser.NetworkDelegate.OnBeforeSendHeaders | ( | BeforeSendHeadersParams | parameters | ) |
Fires when a request is about to occur and the initial headers have been prepared. It allows adding, modifying, and deleting HTTP request headers. This method is invoked synchronously. URL request will be blocked while this method is executing. If this method throws an exception, the loading process will not be affected.
Note that one URL request can be split into several HTTP requests (for example to fetch individual byte ranges from a large file) or can be handled by the network stack without communicating with the network. For this reason, the event does not provide the final HTTP headers that are sent to the network. For example, all headers that are related to caching are invisible.
The following headers are currently not provided to the onBeforeSendHeaders event.
parameters | provides information about request URL, HTTP method ("GET", "POST" etc.) and HTTP request headers. |
Implemented in DotNetBrowser.DefaultNetworkDelegate.
void DotNetBrowser.NetworkDelegate.OnBeforeSendProxyHeaders | ( | BeforeSendProxyHeadersParams | parameters | ) |
The similar to OnBeforeSendHeaders(BeforeSendHeadersParams) method. Fires when proxy connection is used, after OnBeforeSendHeaders method is invoked. Provides information about proxy connection, and also allows adding, modifying, and deleting HTTP request headers.
parameters | provides information about request. |
Implemented in DotNetBrowser.DefaultNetworkDelegate.
void DotNetBrowser.NetworkDelegate.OnBeforeURLRequest | ( | BeforeURLRequestParams | parameters | ) |
Fires when a request is about to occur. This event is sent before any TCP connection is made and can be used to redirect requests to another location. This method is invoked synchronously. URL request will be blocked while this method is executing. If this method throws an exception, then default behavior will be used - the target URL will not be changed.
parameters | provides information about request URL and HTTP method ("GET", "POST" etc.). To override the target URL use the BeforeRedirectParams.SetURL(String)} method. |
Implemented in DotNetBrowser.DefaultNetworkDelegate.
bool DotNetBrowser.NetworkDelegate.OnCanGetCookies | ( | string | url, |
List< Cookie > | cookies | ||
) |
This method is invoked when Chromium engine decides whether cookies can be sent back to the web server. Return true to allow cookies to be sent to the web server.
If this method throws an exception, then default behavior will be applied - the method returns true.
url | a string representation of the URL associated with the cookies. |
cookies | a list of cookies to send. |
Implemented in DotNetBrowser.DefaultNetworkDelegate.
bool DotNetBrowser.NetworkDelegate.OnCanSetCookies | ( | string | url, |
List< Cookie > | cookies | ||
) |
This method is invoked when Chromium engine decides whether cookies can be saved for the url or not. Return true to allow engine to save the cookies. If you return false, the cookies will not be saved and will not be available in CookieStorage.
If this method throws an exception, then default behavior will be applied - the method returns true.
url | a string representation of the URL associated with the cookies. |
cookies | a list of cookies to apply. |
Implemented in DotNetBrowser.DefaultNetworkDelegate.
void DotNetBrowser.NetworkDelegate.OnCompleted | ( | RequestCompletedParams | parameters | ) |
Fires when a request has been processed successfully or failed. You can get information about HTTP request status via the RequestCompletedParams.GetStatus() method. If HTTP request status is RequestStatus.FAILED, you can get information about network error using the RequestCompletedParams.GetErrorCode() method.
parameters | provides information about request URL, HTTP method ("GET", "POST" etc.), request status, response code and network error code. |
Implemented in DotNetBrowser.DefaultNetworkDelegate.
void DotNetBrowser.NetworkDelegate.OnDataReceived | ( | DataReceivedParams | parameters | ) |
This method is invoked each time when a part of the response body is received. When the whole response body is received, OnCompleted(RequestCompletedParams) method will be fired. This event is informational.
Note that Mime-Type and Charset, provided by DataReceivedParams, are taken from response headers and may be overridden by OnHeadersReceived(HeadersReceivedParams) method.
parameters | provides information about request URL, HTTP method ("GET", "POST", etc.), Mime-Type, and response data. |
Implemented in DotNetBrowser.DefaultNetworkDelegate.
void DotNetBrowser.NetworkDelegate.OnDestroyed | ( | RequestParams | parameters | ) |
Fires when a request is being destroyed.
parameters | provides information about request. |
Implemented in DotNetBrowser.DefaultNetworkDelegate.
void DotNetBrowser.NetworkDelegate.OnHeadersReceived | ( | HeadersReceivedParams | parameters | ) |
Fires each time that an HTTP(S) response header is received. Due to redirects and authentication requests this can happen multiple times per request. This event is intended to allow adding, modifying, and deleting HTTP response headers, such as incoming "Set-Cookie" headers.
This method is invoked synchronously. URL request will be blocked while this method is executing. If this method throws an exception, the loading process will not be affected.
parameters | provides information about request URL, HTTP method ("GET", "POST" etc.) and HTTP request headers. |
Implemented in DotNetBrowser.DefaultNetworkDelegate.
void DotNetBrowser.NetworkDelegate.OnPacScriptError | ( | PacScriptErrorParams | pacScriptErrorParams | ) |
This method is invoked when Chromium proxy resolver failed to parse PAC script file to extract proxy settings.
pacScriptErrorParams | details about PAC script error such as line number and error message. |
Implemented in DotNetBrowser.DefaultNetworkDelegate.
void DotNetBrowser.NetworkDelegate.OnResponseStarted | ( | ResponseStartedParams | parameters | ) |
Fires when the first byte of the response body is received. For HTTP requests, this means that the status line and response headers are available. This event is informational.
This method is invoked synchronously. URL request will be blocked while this method is executing. If this method throws an exception, the loading process will not be affected.
parameters | provides information about request URL, HTTP method ("GET", "POST" etc.) and HTTP response code. |
Implemented in DotNetBrowser.DefaultNetworkDelegate.
void DotNetBrowser.NetworkDelegate.OnSendHeaders | ( | SendHeadersParams | parameters | ) |
Fires right before the HTTP headers are sent to the network. This event is informational and it does not allow modifying HTTP headers. This method is invoked synchronously. URL request will be blocked while this method is executing. If this method throws an exception, the loading process will not be affected.
parameters | provides information about request URL, HTTP method ("GET", "POST" etc.) and HTTP request headers. HTTP headers overriding has no effect. |
Implemented in DotNetBrowser.DefaultNetworkDelegate.