UtilWeb Class

Contains web related utilities (http, html, url, mime, etc).

Definition

Namespace: DevCase.Core.Networking.Common
Assembly: DevCase.net48 (in DevCase.net48.dll) Version: 6.0.0.0 (6.0)
XMLNS for XAML: Not mapped to an xmlns.
public sealed class UtilWeb
Inheritance
Object    UtilWeb

Properties

MimeTypes Gets a collection of known MIME types and its file-extensions.
UserAgents Gets a collection of common user-agents, as is, for testing purposes in web-crawlers.

Methods

ConvertHtmlPageToHtmlDocument Converts a string containing an Html source-code to an HtmlDocument.
DownloadData(String) Downloads the specified resource as a Byte array
DownloadData(String, WebProxy) Downloads the specified resource as a Byte array
DownloadData(String, String) Downloads the specified resource as a Byte array
DownloadData(String, WebProxy, String) Downloads the specified resource as a Byte array
DownloadDataAsync(String) Asynchronously downloads the specified resource as a Byte array
DownloadDataAsync(String, WebProxy) Asynchronously downloads the specified resource as a Byte array
DownloadDataAsync(String, String) Asynchronously downloads the specified resource as a Byte array
DownloadDataAsync(String, WebProxy, String) Asynchronously downloads the specified resource as a Byte array
DownloadFile(String, DirectoryInfo) Downloads a file to the specified directory.

The filename will be retrieved from url or from MIME types.

If filename cannot be retrieved, a random filename will be assigned to The output filepath.

DownloadFile(String, FileInfo) Downloads a file to the specified filepath.
DownloadFile(String, String) Downloads a file to the specified directory.

The filename will be retrieved from url or from MIME types.

If filename cannot be retrieved, a random filename will be assigned to The output filepath.

DownloadFile(String, String, String) Downloads a file to the specified filepath.
DownloadFile(WebProxy, String, DirectoryInfo) Downloads a file to the specified directory, using the specified proxy.

The filename will be retrieved from url or from MIME types.

If filename cannot be retrieved, a random filename will be assigned to The output filepath.

DownloadFile(WebProxy, String, FileInfo) Downloads a file to the specified filepath, using the specified proxy.
DownloadFile(WebProxy, String, String) Downloads a file to the specified directory, using the specified proxy.

The filename will be retrieved from url or from MIME types.

If filename cannot be retrieved, a random filename will be assigned to The output filepath.

DownloadFile(WebProxy, String, String, String) Downloads a file to the specified filepath, using the specified proxy.
DownloadFileAsync(String, DirectoryInfo) Asynchronously downloads a file to the specified directory.

The filename will be retrieved from url or from MIME types.

If filename cannot be retrieved, a random filename will be assigned to The output filepath.

DownloadFileAsync(String, FileInfo) Asynchronously downloads a file to the specified filepath.
DownloadFileAsync(String, String) Asynchronously downloads a file to the specified directory.

The filename will be retrieved from url or from MIME types.

If filename cannot be retrieved, a random filename will be assigned to The output filepath.

DownloadFileAsync(String, String, String) Asynchronously downloads a file to the specified filepath.
DownloadFileAsync(WebProxy, String, DirectoryInfo) Asynchronously downloads a file to the specified directory, using the specified proxy.

The filename will be retrieved from url or from MIME types.

If filename cannot be retrieved, a random filename will be assigned to The output filepath.

DownloadFileAsync(WebProxy, String, FileInfo) Asynchronously downloads a file to the specified filepath, using the specified proxy.
DownloadFileAsync(WebProxy, String, String) Asynchronously downloads a file to the specified directory, using the specified proxy.

The filename will be retrieved from url or from MIME types.

If filename cannot be retrieved, a random filename will be assigned to The output filepath.

DownloadFileAsync(String, DirectoryInfo, DownloadProgressChangedEventHandler, AsyncCompletedEventHandler) Asynchronously downloads a file to the specified directory.

The filename will be retrieved from url or from MIME types.

If filename cannot be retrieved, a random filename will be assigned to The output filepath.

DownloadFileAsync(String, FileInfo, DownloadProgressChangedEventHandler, AsyncCompletedEventHandler) Asynchronously downloads a file to the specified filepath.
DownloadFileAsync(String, String, DownloadProgressChangedEventHandler, AsyncCompletedEventHandler) Asynchronously downloads a file to the specified directory.

The filename will be retrieved from url or from MIME types.

If filename cannot be retrieved, a random filename will be assigned to The output filepath.

DownloadFileAsync(WebProxy, String, String, String) Asynchronously downloads a file to the specified filepath, using the specified proxy.
DownloadFileAsync(String, String, String, DownloadProgressChangedEventHandler, AsyncCompletedEventHandler) Asynchronously downloads a file to the specified filepath.
DownloadFileAsync(WebProxy, String, DirectoryInfo, DownloadProgressChangedEventHandler, AsyncCompletedEventHandler) Asynchronously downloads a file to the specified directory, using the specified proxy.

The filename will be retrieved from url or from MIME types.

If filename cannot be retrieved, a random filename will be assigned to The output filepath.

DownloadFileAsync(WebProxy, String, FileInfo, DownloadProgressChangedEventHandler, AsyncCompletedEventHandler) Asynchronously downloads a file to the specified filepath, using the specified proxy.
DownloadFileAsync(WebProxy, String, String, DownloadProgressChangedEventHandler, AsyncCompletedEventHandler) Asynchronously downloads a file to the specified directory, using the specified proxy.

The filename will be retrieved from url or from MIME types.

If filename cannot be retrieved, a random filename will be assigned to The output filepath.

DownloadFileAsync(WebProxy, String, String, String, DownloadProgressChangedEventHandler, AsyncCompletedEventHandler) Asynchronously downloads a file to the specified filepath, using the specified proxy.
DownloadImage(String) Downloads the specified resource as a Image.
DownloadImage(String, WebProxy) Downloads the specified resource as a Image.
DownloadImage(String, String) Downloads the specified resource as a Image.
DownloadImage(String, WebProxy, String) Downloads the specified resource as a Image.
DownloadImageAsync(String) Asynchronously downloads the specified resource as a Image.
DownloadImageAsync(String, WebProxy) Asynchronously downloads the specified resource as a Image.
DownloadImageAsync(String, String) Asynchronously downloads the specified resource as a Image.
DownloadImageAsync(String, WebProxy, String) Asynchronously downloads the specified resource as a Image.
DownloadWebpage(String) Downloads the source-code of an Url that points to an Html document.
DownloadWebpage(Uri) Downloads the source-code of an Url that points to an Html document.
DownloadWebpage(String, KeyValuePairString, String) Downloads the source-code of an Url that points to an Html document.
DownloadWebpage(String, WebProxy) Downloads the source-code of an Url that points to an Html document.
DownloadWebpage(String, String) Downloads the source-code of an Url that points to an Html document.
DownloadWebpage(String, Encoding) Downloads the source-code of an Url that points to an Html document.
DownloadWebpage(Uri, KeyValuePairString, String) Downloads the source-code of an Url that points to an Html document.
DownloadWebpage(Uri, WebProxy) Downloads the source-code of an Url that points to an Html document.
DownloadWebpage(Uri, String) Downloads the source-code of an Url that points to an Html document.
DownloadWebpage(Uri, Encoding) Downloads the source-code of an Url that points to an Html document.
DownloadWebpage(String, WebProxy, KeyValuePairString, String) Downloads the source-code of an Url that points to an Html document.
DownloadWebpage(String, WebProxy, String) Downloads the source-code of an Url that points to an Html document.
DownloadWebpage(String, WebProxy, Encoding) Downloads the source-code of an Url that points to an Html document.
DownloadWebpage(String, String, Encoding) Downloads the source-code of an Url that points to an Html document.
DownloadWebpage(String, Encoding, KeyValuePairString, String) Downloads the source-code of an Url that points to an Html document.
DownloadWebpage(Uri, WebProxy, KeyValuePairString, String) Downloads the source-code of an Url that points to an Html document.
DownloadWebpage(Uri, WebProxy, String) Downloads the source-code of an Url that points to an Html document.
DownloadWebpage(Uri, WebProxy, Encoding) Downloads the source-code of an Url that points to an Html document.
DownloadWebpage(Uri, String, Encoding) Downloads the source-code of an Url that points to an Html document.
DownloadWebpage(Uri, Encoding, KeyValuePairString, String) Downloads the source-code of an Url that points to an Html document.
DownloadWebpage(String, WebProxy, String, Encoding) Downloads the source-code of an Url that points to an Html document.
DownloadWebpage(String, WebProxy, Encoding, KeyValuePairString, String) Downloads the source-code of an Url that points to an Html document.
DownloadWebpage(Uri, WebProxy, String, Encoding) Downloads the source-code of an Url that points to an Html document.
DownloadWebpage(Uri, WebProxy, Encoding, KeyValuePairString, String) Downloads the source-code of an Url that points to an Html document.
DownloadWebpageAsXml(String) Downloads the source-code of an Url that points to an Html document, then transforms it to Xml.
DownloadWebpageAsXml(Uri) Downloads the source-code of an Url that points to an Html document, then transforms it to Xml.
DownloadWebpageAsXml(String, KeyValuePairString, String) Downloads the source-code of an Url that points to an Html document, then transforms it to Xml.
DownloadWebpageAsXml(String, WebProxy) Downloads the source-code of an Url that points to an Html document, then transforms it to Xml.
DownloadWebpageAsXml(String, String) Downloads the source-code of an Url that points to an Html document, then transforms it to Xml.
DownloadWebpageAsXml(String, Encoding) Downloads the source-code of an Url that points to an Html document, then transforms it to Xml.
DownloadWebpageAsXml(Uri, KeyValuePairString, String) Downloads the source-code of an Url that points to an Html document, then transforms it to Xml.
DownloadWebpageAsXml(Uri, WebProxy) Downloads the source-code of an Url that points to an Html document, then transforms it to Xml.
DownloadWebpageAsXml(Uri, String) Downloads the source-code of an Url that points to an Html document, then transforms it to Xml.
DownloadWebpageAsXml(Uri, Encoding) Downloads the source-code of an Url that points to an Html document, then transforms it to Xml.
DownloadWebpageAsXml(String, WebProxy, KeyValuePairString, String) Downloads the source-code of an Url that points to an Html document, then transforms it to Xml.
DownloadWebpageAsXml(String, WebProxy, String) Downloads the source-code of an Url that points to an Html document, then transforms it to Xml.
DownloadWebpageAsXml(String, WebProxy, Encoding) Downloads the source-code of an Url that points to an Html document, then transforms it to Xml.
DownloadWebpageAsXml(String, String, Encoding) Downloads the source-code of an Url that points to an Html document, then transforms it to Xml.
DownloadWebpageAsXml(String, Encoding, KeyValuePairString, String) Downloads the source-code of an Url that points to an Html document, then transforms it to Xml.
DownloadWebpageAsXml(Uri, WebProxy, KeyValuePairString, String) Downloads the source-code of an Url that points to an Html document, then transforms it to Xml.
DownloadWebpageAsXml(Uri, WebProxy, String) Downloads the source-code of an Url that points to an Html document, then transforms it to Xml.
DownloadWebpageAsXml(Uri, WebProxy, Encoding) Downloads the source-code of an Url that points to an Html document, then transforms it to Xml.
DownloadWebpageAsXml(Uri, String, Encoding) Downloads the source-code of an Url that points to an Html document, then transforms it to Xml.
DownloadWebpageAsXml(Uri, Encoding, KeyValuePairString, String) Downloads the source-code of an Url that points to an Html document, then transforms it to Xml.
DownloadWebpageAsXml(String, WebProxy, String, Encoding) Downloads the source-code of an Url that points to an Html document, then transforms it to Xml.
DownloadWebpageAsXml(String, WebProxy, Encoding, KeyValuePairString, String) Downloads the source-code of an Url that points to an Html document, then transforms it to Xml.
DownloadWebpageAsXml(Uri, WebProxy, String, Encoding) Downloads the source-code of an Url that points to an Html document, then transforms it to Xml.
DownloadWebpageAsXml(Uri, WebProxy, Encoding, KeyValuePairString, String) Downloads the source-code of an Url that points to an Html document, then transforms it to Xml.
Equals Determines whether the specified object is equal to the current object.
(Inherited from Object)
GeoLocate(IPAddress) Estimates the real-world geographic location of an IPv4 address.
GeoLocate(String) Estimates the real-world geographic location of a host name.
GeoLocate(Uri) Estimates the real-world geographic location of a host.
GetHashCode Serves as the default hash function.
(Inherited from Object)
GetHttpResponse(HttpWebRequest) Gets the response of an Http request.
GetHttpResponse(String) Gets the Http response of an Http request.
GetHttpResponse(WebRequest) Gets the response of an Http request.
GetMimeType Gets the name of the MIME type of the specified file-extension.
GetMimeTypeExtension Gets the file-extension that is associated to the specified MIME type.
GetPostResponse(String, DictionaryString, String) Sends a POST method request and returns the server response.
GetPostResponse(String, NameValueCollection) Sends a POST method request and returns the server response.
GetPostResponse(Uri, DictionaryString, String) Sends a POST method request and returns the server response.
GetPostResponse(Uri, NameValueCollection) Sends a POST method request and returns the server response.
GetPostResponse(String, CookieContainer, DictionaryString, String) Sends a POST method request and returns the server response.
GetPostResponse(String, CookieContainer, NameValueCollection) Sends a POST method request and returns the server response.
GetPostResponse(Uri, CookieContainer, DictionaryString, String) Sends a POST method request and returns the server response.
GetPostResponse(Uri, CookieContainer, NameValueCollection) Sends a POST method request and returns the server response.
GetPostResponseAsync(String, DictionaryString, String) Asynchronously sends a POST method request and returns the server response.
GetPostResponseAsync(String, NameValueCollection) Asynchronously sends a POST method request and returns the server response.
GetPostResponseAsync(Uri, DictionaryString, String) Asynchronously sends a POST method request and returns the server response.
GetPostResponseAsync(Uri, NameValueCollection) Asynchronously sends a POST method request and returns the server response.
GetPostResponseAsync(String, CookieContainer, DictionaryString, String) Asynchronously sends a POST method request and returns the server response.
GetPostResponseAsync(String, CookieContainer, NameValueCollection) Asynchronously sends a POST method request and returns the server response.
GetPostResponseAsync(Uri, CookieContainer, DictionaryString, String) Asynchronously sends a POST method request and returns the server response.
GetPostResponseAsync(Uri, CookieContainer, NameValueCollection) Asynchronously sends a POST method request and returns the server response.
GetResponseFilename Tries to retrieve the filename of a WebResponse that points to a file.
GetType Gets the Type of the current instance.
(Inherited from Object)
GetUrlFilename Tries to retrieve the filename of an Url that points to a file.
GetUrlStatusCode(String) Sends a GET request to the specified url and returns the http status code of the server response.

To determine whether the specified url is available / online, call IsUrlAvailable(String) function.

GetUrlStatusCode(Uri) Sends a GET request to the specified url and returns the http status code of the server response.

To determine whether the specified url is available / online, call IsUrlAvailable(String) function.

GetUrlStatusCodeAsync(String) Asynchronously sends a GET request to the specified url and returns the http status code of the server response.

To determine whether the specified url is available / online, call IsUrlAvailable(String) function.

GetUrlStatusCodeAsync(Uri) Asynchronously sends a GET request to the specified url and returns the http status code of the server response.

To determine whether the specified url is available / online, call IsUrlAvailable(String) function.

HtmlDecode Converts a string that has been Html-encoded to a decoded string.
HtmlEncode Converts a string to an Html-encoded string.
IsUrlAvailable(String) Pings the specified url to determine whether it is available / online.

To get the http status code of the server response, call GetUrlStatusCode(String) function.

IsUrlAvailable(Uri) Pings the specified url to determine whether it is available / online.

To get the http status code of the server response, call GetUrlStatusCode(String) function.

IsUrlStatusCodeSucessful(String) Sends a GET request to the specified url and returns a value that indicates whether the http status code of the server response was successful.

A response is considered successful if http status code is in range of 200-299.

To determine whether the specified url is available / online, call IsUrlAvailable(String) function.

IsUrlStatusCodeSucessful(Uri) Sends a GET request to the specified url and returns a value that indicates whether the http status code of the server response was successful.

A response is considered successful if http status code is in range of 200-299.

To determine whether the specified url is available / online, call IsUrlAvailable(String) function.

IsUrlStatusCodeSucessfulAsync(String) Asynchronously sends a GET request to the specified url and returns a value that indicates whether the http status code of the server response was successful.

A response is considered successful if http status code is in range of 200-299.

To determine whether the specified url is available / online, call IsUrlAvailable(String) function.

IsUrlStatusCodeSucessfulAsync(Uri) Asynchronously sends a GET request to the specified url and returns a value that indicates whether the http status code of the server response was successful.

A response is considered successful if http status code is in range of 200-299.

To determine whether the specified url is available / online, call IsUrlAvailable(String) function.

PostXmlHttpRequest(String, XDocument, ActionHttpWebRequest) Posts an XML HTTP request to the specified server with default encoding (UTF8), and returns the response.
PostXmlHttpRequest(Uri, String, ActionHttpWebRequest) Posts an XML HTTP request to the specified server with default encoding (UTF8), and returns the response.
PostXmlHttpRequest(Uri, XDocument, ActionHttpWebRequest) Posts an XML HTTP request to the specified server with default encoding (UTF8), and returns the response.
PostXmlHttpRequest(String, XDocument, Encoding, ActionHttpWebRequest) Posts an XML HTTP request to the specified server with a custom Encoding, and returns the response.
PostXmlHttpRequest(Uri, String, Encoding, ActionHttpWebRequest) Posts an XML HTTP request to the specified server with a custom Encoding, and returns the response.
PostXmlHttpRequest(Uri, XDocument, Encoding, ActionHttpWebRequest) Posts an XML HTTP request to the specified server with a custom Encoding, and returns the response.
PostXmlHttpRequestAsync(String, XDocument, ActionHttpWebRequest) Asynchronously posts an XML HTTP request to the specified server with default encoding (UTF8), and returns the response.
PostXmlHttpRequestAsync(Uri, String, ActionHttpWebRequest) Asynchronously posts an XML HTTP request to the specified server with default encoding (UTF8), and returns the response.
PostXmlHttpRequestAsync(Uri, XDocument, ActionHttpWebRequest) Asynchronously posts an XML HTTP request to the specified server with default encoding (UTF8), and returns the response.
PostXmlHttpRequestAsync(String, XDocument, Encoding, ActionHttpWebRequest) Asynchronously posts an XML HTTP request to the specified server with a custom Encoding, and returns the response.
PostXmlHttpRequestAsync(Uri, String, Encoding, ActionHttpWebRequest) Asynchronously posts an XML HTTP request to the specified server with a custom Encoding, and returns the response.
PostXmlHttpRequestAsync(Uri, XDocument, Encoding, ActionHttpWebRequest) Asynchronously posts an XML HTTP request to the specified server with a custom Encoding, and returns the response.
RedirectUri(String) Redirects an Url that points to other Url.
RedirectUri(Uri) Redirects an Url that points to other Url.
RedirectUri(String, Int32) Redirects an Url that points to other Url.
RedirectUri(String, String) Redirects an Url that points to other Url.
RedirectUri(Uri, Int32) Redirects an Url that points to other Url.
RedirectUri(Uri, String) Redirects an Url that points to other Url.
RedirectUri(String, Int32, String) Redirects an Url that points to other Url.
RedirectUri(Uri, Int32, String) Redirects an Url that points to other Url.
SetCookies(String, Boolean, Cookie) Sets one or more cookies for the specified URL.
SetCookies(String, Boolean, CookieCollection) Sets one or more cookies for the specified URL.
SetCookies(Uri, Boolean, Cookie) Sets one or more cookies for the specified URI.
SetCookies(Uri, Boolean, CookieCollection) Sets one or more cookies for the specified URI.
ToString Returns a string that represents the current object.
(Inherited from Object)
UrlDecode Decodes a Url-encoded string.
UrlEncode Encodes a Url string.
ValidateUrl Validates an Url.

Note that the source Url should be absolute, not relative.

Extension Methods

CanConvertTo Determines whether the source object can be converted to the specified target type.
(Defined by ObjectExtensions)
CanConvertToT Determines whether the source object can be converted to the specified target type.
(Defined by ObjectExtensions)
ConvertToT Converts an object to the specified target type.

If the conversion fails, an exception is thrown.
(Defined by ObjectExtensions)

ConvertToT Converts an object to the specified target type.

If the conversion fails, returns the specified default value.
(Defined by ObjectExtensions)

IsDisposable Determines whether the specified object is a disposable type (i.e., it implements IDisposable interface).
(Defined by ObjectExtensions)
Speak Speaks the string representation of the source object by using the operating system integrated text-to-speech synthesizer.
(Defined by ObjectExtensions)
Speak Speaks the string representation of the source object by using the operating system integrated text-to-speech synthesizer.
(Defined by ObjectExtensions)
ThrowIfNullTException Throws the specified exception if the source object is null.
(Defined by ObjectExtensions)

See Also