C# Class AutoWPApi.AutoWP.HttpHelper

Utility class for simplify http parsing
Show file Open project: ForjaOMF/OMF-WinMobileSDK

Public Methods

Method Description
ExecuteRequest ( string url, string contentType, string method, string body, Header optionalHeaders, bool autoRedirect ) : HttpWebResponse

Performs a HTTP request

ExtractValue ( string data, string from, string to ) : string

Extract text value between the two provided strings

ParseCookie ( string cookie ) : string
ReadBody ( HttpWebResponse response ) : byte[]

Read received body

ReadBody ( HttpWebResponse response, System encoding ) : string

Read received body

Save2disk ( string filename, byte data ) : void

Method Details

ExecuteRequest() public static method

Performs a HTTP request
public static ExecuteRequest ( string url, string contentType, string method, string body, Header optionalHeaders, bool autoRedirect ) : HttpWebResponse
url string Target URL
contentType string Content-Type Header
method string HTTP Method (POST/GET)
body string string data to send when method is POST
optionalHeaders Header Array of optional headers needed by the request
autoRedirect bool Allows automatically performig autoredirect when the server invokes it
return System.Net.HttpWebResponse

ExtractValue() public static method

Extract text value between the two provided strings
public static ExtractValue ( string data, string from, string to ) : string
data string source string
from string Start string chunk
to string End string chunk
return string

ParseCookie() public static method

public static ParseCookie ( string cookie ) : string
cookie string
return string

ReadBody() public static method

Read received body
public static ReadBody ( HttpWebResponse response ) : byte[]
response System.Net.HttpWebResponse Http response received from the server
return byte[]

ReadBody() public static method

Read received body
public static ReadBody ( HttpWebResponse response, System encoding ) : string
response System.Net.HttpWebResponse Http response received from the server
encoding System Content-Encoding used to decode the buffer
return string

Save2disk() public static method

public static Save2disk ( string filename, byte data ) : void
filename string
data byte
return void