C# Класс CsQuery.Web.CsqWebRequest

A CsqWebRequest object manages data and state related to a WebRequest
Наследование: ICsqWebRequest
Показать файл Открыть проект Примеры использования класса

Открытые методы

Метод Описание
CsqWebRequest ( string url ) : System

Creates a new CsqWebRequest for a given URL using the default IHttpWebRequestFactory.

CsqWebRequest ( string url, IHttpWebRequestFactory webRequestFactory ) : System

Creates a new CsqWebRequest for a URL using the provided IHttpWebRequestFactory. (Usually, you should use the default constructor, unless replacing the .NET framework HttpWebRequest object for testing or some other purpose)

Get ( ) : string

Get the HTML using a synchronous HTTP request. This will return a string using the encoding specified by the MIME type. If the document uses an encoding specified in a content-type header, it will NOT be reflected by the results of this method.

Get ( IHttpWebRequest request ) : string

Initiate a synchronous GET request from an existing IHttpWebRequest object

GetAsync ( Action success, Action fail ) : ManualResetEvent

Initiates an asynchronous GET request.

GetAsync ( IHttpWebRequest request, Action success, Action fail ) : ManualResetEvent

Initiates an asynchronous GET request from an IHttpWebRequest object.

GetEncoding ( IHttpWebResponse response ) : Encoding

Return the character set encoding for an IHttpWebResponse, or null if no encoding is specified.

GetWebRequest ( ) : IHttpWebRequest

Gets a new HttpWebRequest object for the URL bound to this CsqWebRequest.

Post ( ) : string

Initiate an http POST request.

Post ( string url ) : string

Initiate an http POST request.

Post ( string url, string>.IEnumerable postData ) : string

Initiate an http POST request.

Защищенные методы

Метод Описание
GetResponseStreamReader ( IHttpWebRequest request ) : StreamReader

Gets response stream from a webrequest using the correct encoding. If the encoding is not specified, then the encoding will be detected from the BOM.

Приватные методы

Метод Описание
ApplyOptions ( IHttpWebRequest request ) : void

Описание методов

CsqWebRequest() публичный Метод

Creates a new CsqWebRequest for a given URL using the default IHttpWebRequestFactory.
public CsqWebRequest ( string url ) : System
url string /// URL of the document. ///
Результат System

CsqWebRequest() публичный Метод

Creates a new CsqWebRequest for a URL using the provided IHttpWebRequestFactory. (Usually, you should use the default constructor, unless replacing the .NET framework HttpWebRequest object for testing or some other purpose)
public CsqWebRequest ( string url, IHttpWebRequestFactory webRequestFactory ) : System
url string /// URL of the document. ///
webRequestFactory IHttpWebRequestFactory /// The web request factory. ///
Результат System

Get() публичный Метод

Get the HTML using a synchronous HTTP request. This will return a string using the encoding specified by the MIME type. If the document uses an encoding specified in a content-type header, it will NOT be reflected by the results of this method.
public Get ( ) : string
Результат string

Get() публичный Метод

Initiate a synchronous GET request from an existing IHttpWebRequest object
public Get ( IHttpWebRequest request ) : string
request IHttpWebRequest /// The request. ///
Результат string

GetAsync() публичный Метод

Initiates an asynchronous GET request.
public GetAsync ( Action success, Action fail ) : ManualResetEvent
success Action /// A delegate that will be invoked with the response data structure upon successful resolution /// of the request. ///
fail Action /// A delegate that will be invoked with the response data structure upon failure. ///
Результат System.Threading.ManualResetEvent

GetAsync() публичный Метод

Initiates an asynchronous GET request from an IHttpWebRequest object.
public GetAsync ( IHttpWebRequest request, Action success, Action fail ) : ManualResetEvent
request IHttpWebRequest /// The request. ///
success Action /// A delegate that will be invoked with the response data structure upon successful resolution /// of the request. ///
fail Action /// A delegate that will be invoked with the response data structure upon failure. ///
Результат System.Threading.ManualResetEvent

GetEncoding() публичный статический Метод

Return the character set encoding for an IHttpWebResponse, or null if no encoding is specified.
public static GetEncoding ( IHttpWebResponse response ) : Encoding
response IHttpWebResponse /// The response. ///
Результат System.Text.Encoding

GetResponseStreamReader() защищенный Метод

Gets response stream from a webrequest using the correct encoding. If the encoding is not specified, then the encoding will be detected from the BOM.
protected GetResponseStreamReader ( IHttpWebRequest request ) : StreamReader
request IHttpWebRequest /// The request. ///
Результат System.IO.StreamReader

GetWebRequest() публичный Метод

Gets a new HttpWebRequest object for the URL bound to this CsqWebRequest.
public GetWebRequest ( ) : IHttpWebRequest
Результат IHttpWebRequest

Post() публичный Метод

Initiate an http POST request.
public Post ( ) : string
Результат string

Post() публичный Метод

Initiate an http POST request.
public Post ( string url ) : string
url string /// URL of the document. ///
Результат string

Post() публичный Метод

Initiate an http POST request.
public Post ( string url, string>.IEnumerable postData ) : string
url string /// URL of the document. ///
postData string>.IEnumerable /// The information describing the post data to be sent this request. ///
Результат string