C# Класс Argentini.Halide.H3Http

The H3Http class contains methods and properties for performing or evaluating HTTP operations. This includes cookies, domain redirection, and more.
Показать файл Открыть проект

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

Метод Описание
AddCrossBrowserClientRedirect ( Page pageToAddScriptTo, String url ) : void

Add a cross browser compliant client side redirect (which ensures that the Referrer value will be not null on the subsequent page) with a zero second delay.

AddCrossBrowserClientRedirect ( Page pageToAddScriptTo, String url, Int32 seconds ) : void

Add a cross browser compliant client side redirect (which ensures that the Referrer value will be not null on the subsequent page).

AddUrlParamPrefix ( String urlParams ) : String

When passed a URL parameter list, it is returned with the leading "?", or as a blank string if there are no parameters. This method is used to ensure that a URL parameter list starts with a "?".

DeleteUrlParameter ( String urlParam ) : String

Remove a URL parameter from the current URL parameter list and return the new request string.

DeleteUrlParameter ( String urlParam, String urlParameterString ) : String

Remove a URL parameter and return the new request string.

DomainRedirect ( String defaultPageName, String domainName ) : String

Determine if the user needs to be redirected to a new URL, for sites that have multiple domain names, but one primary (e.g. like catching misspellings in domain names). The transport (e.g. http://) is not used or returned with the result of the method.

GetBrowser ( String userAgent ) : String

Return the browser name and version.

GetBrowser ( String userAgent, System.Int64 &majorVersion, System.Int64 &minorVersion, System.Int64 &buildVersion, String &browserName ) : String

Return the browser name and version.

GetBrowserMajorVersion ( ) : String

Return the browser major version number.

GetBrowserMinorVersion ( ) : String

Return the browser minor version number.

GetBrowserName ( ) : String

Return the browser name.

GetBrowserVersion ( String browserName ) : Double

Return the version of specific browser based on HTTP headers or -1 if the request came from another browser.

GetCurrentPageName ( ) : String

Retrieve the current page file name on disk.

GetFirefoxVersion ( ) : Double

Return the version of Mozilla Firefox being used or -1 if the request came from another browser.

GetHost ( ) : String

Get the fully qualified domain name of the current URL.

GetHostRoot ( ) : String

Get the root domain from the fully qualified domain name of the current URL. (e.g. if visiting "www.mydomain.com", "mydomain.com" is returned.)

GetIPAddress ( ) : String

Return the IP address of a web visitor.

GetInternetExplorerVersion ( ) : Double

Return the version of Internet Explorer being used or -1 if the request came from another browser.

GetOSType ( ) : String

Return the operating system type for the current user agent

GetOSType ( String userAgent ) : String

Return the operating system type and version for the current user agent

GetOSType ( String userAgent, System.Int64 &majorVersion, System.Int64 &minorVersion, System.Int64 &buildVersion, String &osName ) : String

Return the operating system type for the current user agent

GetRedirectCodeText ( Int32 redirectCode ) : String

Contains the following Indexes: 301,302,303,304,305,307

GetSafariVersion ( ) : Double

Return the version of Apple Safari being used or -1 if the request came from another browser.

GetUrlParams ( ) : String

Get the current URL parameters as a single string, without the leading "?".

GetUrlParams ( System.Boolean includePrefix ) : String

Get the current URL parameters as a single string, without the leading "?".

GetWebPage ( String url ) : String

Perform an Http GET operation, and return the result.

GetWebPage ( String url, CookieContainer cookies ) : String

Perform an Http GET operation, passing cookies, and return the result.

GetWebPage ( String url, GetWebPageMethod method, CookieContainer cookies, String postData, String userName, String password ) : String

Perform an Http GET or POST operation, passing cookies, post data, user name and password, and return the result.

GetWebPage ( String url, GetWebPageMethod method, CookieContainer cookies, String postData, String userName, String password, Int32 timeoutMilliseconds ) : String

Perform an Http GET or POST operation, passing cookies, post data, user name and password, and return the result.

GetWebPage ( String url, GetWebPageMethod method, String postData ) : String

Perform an Http GET or POST operation, and return the result.

GetWebPage ( String url, Int32 timeoutMilliseconds ) : String

Perform an Http GET operation, and return the result. Timeout in milliseconds is passed as well.

GetWebPage ( String url, String userName, String password ) : String

Perform an Http GET operation, passing credentials, and return the result.

Redirect ( Page pageToRedirect, String redirectLocation, Int32 code ) : void

Core redirect function. Redirects the provided page using the provided redirect code and location. Usage: H3Http.Redirect(this, "http://fynydd.com", 301);

Redirect303 ( Page pageToRedirect, String redirectLocation ) : void

Commonly used 303 redirect ("See Other"). Redirects the user, but the browser is instructed not to cache this response. Similar to 307, but more SEO friendly. Usage: H3Http.Redirect303(this, "http://fynydd.com");

Redirect307 ( Page pageToRedirect, String redirectLocation ) : void

Commonly used 307 redirect ("Temporary Redirect"). Redirects the user, but the browser is instructed that it *should* not cache this response (not guaranteed). Usage: H3Http.Redirect307(this, "http://fynydd.com");

SetUrlParameterValue ( String urlParam, String value ) : String

Add or Edit a URL parameter value in the current URL. If the parameter exists, it is modified. Otherwise, its value is changed.

SetUrlParameterValue ( String urlParam, String value, String urlParameterString ) : String

Add or Edit a URL parameter value. If the parameter exists on the supplied URL parameter string, it is modified. Otherwise, its value is changed.

WriteBinaryFile ( String url, String filePath ) : System.Int64

Read a binary file from a URL and write it to disk.

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

Метод Описание
BuildMatch ( String pattern, String userAgent, String browser, Int32 versionIndex, String browserNameVersionFallback, String &browserName, System.Int64 &majorVersion, System.Int64 &minorVersion, System.Int64 &buildVersion ) : String
H3Http ( ) : System

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

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

Add a cross browser compliant client side redirect (which ensures that the Referrer value will be not null on the subsequent page) with a zero second delay.
public static AddCrossBrowserClientRedirect ( Page pageToAddScriptTo, String url ) : void
pageToAddScriptTo System.Web.UI.Page The page to which the ClientScript will be Registered as a StartupScript.
url String String representation of a URL to which the page will redirect.
Результат void

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

Add a cross browser compliant client side redirect (which ensures that the Referrer value will be not null on the subsequent page).
public static AddCrossBrowserClientRedirect ( Page pageToAddScriptTo, String url, Int32 seconds ) : void
pageToAddScriptTo System.Web.UI.Page The page to which the ClientScript will be Registered as a StartupScript.
url String String representation of a URL to which the page will redirect.
seconds System.Int32 Int32 value of seconds to delay before redirecting.
Результат void

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

When passed a URL parameter list, it is returned with the leading "?", or as a blank string if there are no parameters. This method is used to ensure that a URL parameter list starts with a "?".
public static AddUrlParamPrefix ( String urlParams ) : String
urlParams String URL parameters list with or without the leading "?".
Результат String

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

Remove a URL parameter from the current URL parameter list and return the new request string.
public static DeleteUrlParameter ( String urlParam ) : String
urlParam String Name of the URL parameter to remove.
Результат String

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

Remove a URL parameter and return the new request string.
public static DeleteUrlParameter ( String urlParam, String urlParameterString ) : String
urlParam String Name of the URL parameter to remove.
urlParameterString String The URL parameter string to modify, without the leading "?".
Результат String

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

Determine if the user needs to be redirected to a new URL, for sites that have multiple domain names, but one primary (e.g. like catching misspellings in domain names). The transport (e.g. http://) is not used or returned with the result of the method.
public static DomainRedirect ( String defaultPageName, String domainName ) : String
defaultPageName String default page file name used on the site (e.g. default.aspx).
domainName String Primary domain name that should be used (e.g. nonsequiturs.com).
Результат String

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

Return the browser name and version.
public static GetBrowser ( String userAgent ) : String
userAgent String Browser user agent string
Результат String

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

Return the browser name and version.
public static GetBrowser ( String userAgent, System.Int64 &majorVersion, System.Int64 &minorVersion, System.Int64 &buildVersion, String &browserName ) : String
userAgent String Browser user agent string
majorVersion System.Int64 Output of major version
minorVersion System.Int64 Output of minor version
buildVersion System.Int64 Output of build version
browserName String Output of browser name
Результат String

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

Return the browser major version number.
public static GetBrowserMajorVersion ( ) : String
Результат String

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

Return the browser minor version number.
public static GetBrowserMinorVersion ( ) : String
Результат String

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

Return the browser name.
public static GetBrowserName ( ) : String
Результат String

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

Return the version of specific browser based on HTTP headers or -1 if the request came from another browser.
public static GetBrowserVersion ( String browserName ) : Double
browserName String
Результат Double

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

Retrieve the current page file name on disk.
public static GetCurrentPageName ( ) : String
Результат String

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

Return the version of Mozilla Firefox being used or -1 if the request came from another browser.
public static GetFirefoxVersion ( ) : Double
Результат Double

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

Get the fully qualified domain name of the current URL.
public static GetHost ( ) : String
Результат String

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

Get the root domain from the fully qualified domain name of the current URL. (e.g. if visiting "www.mydomain.com", "mydomain.com" is returned.)
public static GetHostRoot ( ) : String
Результат String

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

Return the IP address of a web visitor.
public static GetIPAddress ( ) : String
Результат String

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

Return the version of Internet Explorer being used or -1 if the request came from another browser.
public static GetInternetExplorerVersion ( ) : Double
Результат Double

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

Return the operating system type for the current user agent
public static GetOSType ( ) : String
Результат String

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

Return the operating system type and version for the current user agent
public static GetOSType ( String userAgent ) : String
userAgent String Web browser User Agent string
Результат String

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

Return the operating system type for the current user agent
public static GetOSType ( String userAgent, System.Int64 &majorVersion, System.Int64 &minorVersion, System.Int64 &buildVersion, String &osName ) : String
userAgent String Web browser User Agent string
majorVersion System.Int64 Output of major version
minorVersion System.Int64 Output of minor version
buildVersion System.Int64 Output of build version
osName String Output of OS name
Результат String

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

Contains the following Indexes: 301,302,303,304,305,307
public static GetRedirectCodeText ( Int32 redirectCode ) : String
redirectCode System.Int32 Redirect Code number (e.g. 301)
Результат String

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

Return the version of Apple Safari being used or -1 if the request came from another browser.
public static GetSafariVersion ( ) : Double
Результат Double

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

Get the current URL parameters as a single string, without the leading "?".
public static GetUrlParams ( ) : String
Результат String

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

Get the current URL parameters as a single string, without the leading "?".
public static GetUrlParams ( System.Boolean includePrefix ) : String
includePrefix System.Boolean Include the leading "?" if there are parameters.
Результат String

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

Perform an Http GET operation, and return the result.
public static GetWebPage ( String url ) : String
url String Fully qualified URL to the remote page.
Результат String

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

Perform an Http GET operation, passing cookies, and return the result.
public static GetWebPage ( String url, CookieContainer cookies ) : String
url String Fully qualified URL to the remote page.
cookies System.Net.CookieContainer CookieContainer variable for sending cookies.
Результат String

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

Perform an Http GET or POST operation, passing cookies, post data, user name and password, and return the result.
public static GetWebPage ( String url, GetWebPageMethod method, CookieContainer cookies, String postData, String userName, String password ) : String
url String Fully qualified URL to the remote page.
method GetWebPageMethod GetWebPageMethod enum value.
cookies System.Net.CookieContainer CookieContainer variable for sending cookies.
postData String String post data for sending a post.
userName String User name string for Windows Authentication.
password String password string for Windows Authentication.
Результат String

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

Perform an Http GET or POST operation, passing cookies, post data, user name and password, and return the result.
public static GetWebPage ( String url, GetWebPageMethod method, CookieContainer cookies, String postData, String userName, String password, Int32 timeoutMilliseconds ) : String
url String Fully qualified URL to the remote page.
method GetWebPageMethod GetWebPageMethod enum value.
cookies System.Net.CookieContainer CookieContainer variable for sending cookies.
postData String String post data for sending a post.
userName String User name string for Windows Authentication.
password String password string for Windows Authentication.
timeoutMilliseconds System.Int32 Timeout in milliseconds for the request.
Результат String

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

Perform an Http GET or POST operation, and return the result.
public static GetWebPage ( String url, GetWebPageMethod method, String postData ) : String
url String Fully qualified URL to the remote page.
method GetWebPageMethod GetWebPageMethod enum value.
postData String String post data for sending a post.
Результат String

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

Perform an Http GET operation, and return the result. Timeout in milliseconds is passed as well.
public static GetWebPage ( String url, Int32 timeoutMilliseconds ) : String
url String Fully qualified URL to the remote page.
timeoutMilliseconds System.Int32 Timeout in milliseconds for the request.
Результат String

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

Perform an Http GET operation, passing credentials, and return the result.
public static GetWebPage ( String url, String userName, String password ) : String
url String Fully qualified URL to the remote page.
userName String User name string for Windows Authentication.
password String password string for Windows Authentication.
Результат String

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

Core redirect function. Redirects the provided page using the provided redirect code and location. Usage: H3Http.Redirect(this, "http://fynydd.com", 301);
public static Redirect ( Page pageToRedirect, String redirectLocation, Int32 code ) : void
pageToRedirect System.Web.UI.Page The Page object which is to be redirected
redirectLocation String The url to which the page will be redirected
code System.Int32 The 3 digit (301,302,303,304,305, or 307) redirect code to use.
Результат void

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

Commonly used 303 redirect ("See Other"). Redirects the user, but the browser is instructed not to cache this response. Similar to 307, but more SEO friendly. Usage: H3Http.Redirect303(this, "http://fynydd.com");
public static Redirect303 ( Page pageToRedirect, String redirectLocation ) : void
pageToRedirect System.Web.UI.Page The Page object which is to be redirected
redirectLocation String The url to which the page will be redirected
Результат void

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

Commonly used 307 redirect ("Temporary Redirect"). Redirects the user, but the browser is instructed that it *should* not cache this response (not guaranteed). Usage: H3Http.Redirect307(this, "http://fynydd.com");
public static Redirect307 ( Page pageToRedirect, String redirectLocation ) : void
pageToRedirect System.Web.UI.Page The Page object which is to be redirected
redirectLocation String The url to which the page will be redirected
Результат void

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

Add or Edit a URL parameter value in the current URL. If the parameter exists, it is modified. Otherwise, its value is changed.
public static SetUrlParameterValue ( String urlParam, String value ) : String
urlParam String Name of the URL parameter.
value String Value of the URL parameter to add or edit.
Результат String

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

Add or Edit a URL parameter value. If the parameter exists on the supplied URL parameter string, it is modified. Otherwise, its value is changed.
public static SetUrlParameterValue ( String urlParam, String value, String urlParameterString ) : String
urlParam String Name of the URL parameter.
value String Value of the URL parameter to add or edit.
urlParameterString String The URL parameter string to modify, without the leading "?".
Результат String

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

Read a binary file from a URL and write it to disk.
public static WriteBinaryFile ( String url, String filePath ) : System.Int64
url String URL to the web resource.
filePath String Web-style path for the destination file on disk, including new file name.
Результат System.Int64