C# 클래스 Thrinax.Helper.HttpHelper

파일 보기 프로젝트 열기: ziyunhx/thrinax

공개 메소드들

메소드 설명
ConvertToCookieContainer ( string>.Dictionary cookies ) : CookieContainer

convert cookies string to CookieContainer

CreateGetHttpResponse ( string url, int timeout = 8000, string userAgent = null, CookieContainer cookies = null, string referer = null, IWebProxy proxy = null, string contentType = null, string>.Dictionary headers = null ) : HttpWebResponse

创建GET方式的HTTP请求

CreatePostHttpResponse ( string url, string postData, int timeout = 8000, string userAgent = null, CookieContainer cookies = null, string referer = null, IWebProxy proxy = null, string contentType = null, string>.Dictionary headers = null ) : HttpWebResponse

创建POST方式的HTTP请求

GetAllCookies ( CookieContainer cookieContainer ) : string>.Dictionary

Get all cookies from CookieContainer.

GetHttpContent ( string url, string postData = null, CookieContainer cookies = null, string userAgent = null, string referer = null, string cookiesDomain = null, Encoding encode = null, string method = null, IWebProxy proxy = null, string encoding = null, string contentType = null, int timeout = 8000, string>.Dictionary headers = null ) : string

获取网页的内容

HttpRequest ( string url, string postData = null, CookieContainer cookies = null, string userAgent = null, string referer = null, string cookiesDomain = null, Encoding encode = null, string method = null, IWebProxy proxy = null, string encoding = null, string contentType = null, int timeout = 8000, string>.Dictionary headers = null ) : Thrinax.Data.HttpResult

使用Http Request获取网页信息

비공개 메소드들

메소드 설명
CheckValidationResult ( object sender, X509Certificate certificate, X509Chain chain, SslPolicyErrors errors ) : bool

验证证书

DetermineResultStatus ( Exception ex ) : int

根据异常内容判断状态类型

SetCookie ( HttpWebResponse response, string defaultDomain ) : CookieCollection

根据response中头部的set-cookie对request中的cookie进行设置

메소드 상세

ConvertToCookieContainer() 공개 정적인 메소드

convert cookies string to CookieContainer
public static ConvertToCookieContainer ( string>.Dictionary cookies ) : CookieContainer
cookies string>.Dictionary cookies dictionary.
리턴 System.Net.CookieContainer

CreateGetHttpResponse() 공개 정적인 메소드

创建GET方式的HTTP请求
public static CreateGetHttpResponse ( string url, int timeout = 8000, string userAgent = null, CookieContainer cookies = null, string referer = null, IWebProxy proxy = null, string contentType = null, string>.Dictionary headers = null ) : HttpWebResponse
url string
timeout int
userAgent string
cookies System.Net.CookieContainer
referer string
proxy IWebProxy
contentType string
headers string>.Dictionary
리턴 System.Net.HttpWebResponse

CreatePostHttpResponse() 공개 정적인 메소드

创建POST方式的HTTP请求
public static CreatePostHttpResponse ( string url, string postData, int timeout = 8000, string userAgent = null, CookieContainer cookies = null, string referer = null, IWebProxy proxy = null, string contentType = null, string>.Dictionary headers = null ) : HttpWebResponse
url string
postData string
timeout int
userAgent string
cookies System.Net.CookieContainer
referer string
proxy IWebProxy
contentType string
headers string>.Dictionary
리턴 System.Net.HttpWebResponse

GetAllCookies() 공개 정적인 메소드

Get all cookies from CookieContainer.
public static GetAllCookies ( CookieContainer cookieContainer ) : string>.Dictionary
cookieContainer System.Net.CookieContainer the CookieContainer
리턴 string>.Dictionary

GetHttpContent() 공개 정적인 메소드

获取网页的内容
public static GetHttpContent ( string url, string postData = null, CookieContainer cookies = null, string userAgent = null, string referer = null, string cookiesDomain = null, Encoding encode = null, string method = null, IWebProxy proxy = null, string encoding = null, string contentType = null, int timeout = 8000, string>.Dictionary headers = null ) : string
url string Url
postData string Post的信息
cookies System.Net.CookieContainer Cookies
userAgent string 浏览器标识
referer string 来源页
cookiesDomain string Cookies的Domian参数,配合cookies使用;为空则取url的Host
encode System.Text.Encoding 编码方式,用于解析html
method string 提交方式,例如POST或GET,默认通过postData是否为空判断
proxy IWebProxy
encoding string
contentType string
timeout int
headers string>.Dictionary
리턴 string

HttpRequest() 공개 정적인 메소드

使用Http Request获取网页信息
public static HttpRequest ( string url, string postData = null, CookieContainer cookies = null, string userAgent = null, string referer = null, string cookiesDomain = null, Encoding encode = null, string method = null, IWebProxy proxy = null, string encoding = null, string contentType = null, int timeout = 8000, string>.Dictionary headers = null ) : Thrinax.Data.HttpResult
url string Url
postData string Post的信息
cookies System.Net.CookieContainer Cookies
userAgent string 浏览器标识
referer string 来源页
cookiesDomain string Cookies的Domian参数,配合cookies使用;为空则取url的Host
encode System.Text.Encoding 编码方式,用于解析html
method string 提交方式,例如POST或GET,默认通过postData是否为空判断
proxy IWebProxy
encoding string
contentType string
timeout int
headers string>.Dictionary
리턴 Thrinax.Data.HttpResult