HttpUtils
Assembly: ServiceStack.Text.dll
Declaration
public static class HttpUtils
Properties
UseEncoding
Declaration
public static Encoding UseEncoding { get; set; }
Fields
UserAgent
Declaration
public static string UserAgent
ResultsFilter
Declaration
[ThreadStatic]
public static IHttpResultsFilter ResultsFilter
Methods
AddQueryParam(String, String, Object, Boolean)
Declaration
public static string AddQueryParam(this string url, string key, object val, bool encode = true)
Returns
System.String
Parameters
Type | Name |
---|
System.String | url |
System.String | key |
System.Object | val |
System.Boolean | encode |
AddQueryParam(String, Object, String, Boolean)
Declaration
public static string AddQueryParam(this string url, object key, string val, bool encode = true)
Returns
System.String
Parameters
Type | Name |
---|
System.String | url |
System.Object | key |
System.String | val |
System.Boolean | encode |
AddQueryParam(String, String, String, Boolean)
Declaration
public static string AddQueryParam(this string url, string key, string val, bool encode = true)
Returns
System.String
Parameters
Type | Name |
---|
System.String | url |
System.String | key |
System.String | val |
System.Boolean | encode |
SetQueryParam(String, String, String)
Declaration
public static string SetQueryParam(this string url, string key, string val)
Returns
System.String
Parameters
Type | Name |
---|
System.String | url |
System.String | key |
System.String | val |
AddHashParam(String, String, Object)
Declaration
public static string AddHashParam(this string url, string key, object val)
Returns
System.String
Parameters
Type | Name |
---|
System.String | url |
System.String | key |
System.Object | val |
AddHashParam(String, String, String)
Declaration
public static string AddHashParam(this string url, string key, string val)
Returns
System.String
Parameters
Type | Name |
---|
System.String | url |
System.String | key |
System.String | val |
SetHashParam(String, String, String)
Declaration
public static string SetHashParam(this string url, string key, string val)
Returns
System.String
Parameters
Type | Name |
---|
System.String | url |
System.String | key |
System.String | val |
HasRequestBody(String)
Declaration
public static bool HasRequestBody(string httpMethod)
Returns
System.Boolean
Parameters
Type | Name |
---|
System.String | httpMethod |
GetRequestStreamAsync(WebRequest)
Declaration
public static Task<Stream> GetRequestStreamAsync(this WebRequest request)
Returns
System.Threading.Tasks.Task<System.IO.Stream>
Parameters
Type | Name |
---|
System.Net.WebRequest | request |
GetRequestStreamAsync(HttpWebRequest)
Declaration
public static Task<Stream> GetRequestStreamAsync(this HttpWebRequest request)
Returns
System.Threading.Tasks.Task<System.IO.Stream>
Parameters
Type | Name |
---|
System.Net.HttpWebRequest | request |
ConvertTo<TDerived, TBase>(Task<TDerived>)
Declaration
public static Task<TBase> ConvertTo<TDerived, TBase>(this Task<TDerived> task)
where TDerived : TBase
Returns
System.Threading.Tasks.Task<<TBase>>
Parameters
Type | Name |
---|
System.Threading.Tasks.Task<<TDerived>> | task |
Type Parameters
GetResponseAsync(WebRequest)
Declaration
public static Task<WebResponse> GetResponseAsync(this WebRequest request)
Returns
System.Threading.Tasks.Task<System.Net.WebResponse>
Parameters
Type | Name |
---|
System.Net.WebRequest | request |
GetResponseAsync(HttpWebRequest)
Declaration
public static Task<HttpWebResponse> GetResponseAsync(this HttpWebRequest request)
Returns
System.Threading.Tasks.Task<System.Net.HttpWebResponse>
Parameters
Type | Name |
---|
System.Net.HttpWebRequest | request |
IsAny300(Exception)
Declaration
public static bool IsAny300(this Exception ex)
Returns
System.Boolean
Parameters
Type | Name |
---|
System.Exception | ex |
IsAny400(Exception)
Declaration
public static bool IsAny400(this Exception ex)
Returns
System.Boolean
Parameters
Type | Name |
---|
System.Exception | ex |
IsAny500(Exception)
Declaration
public static bool IsAny500(this Exception ex)
Returns
System.Boolean
Parameters
Type | Name |
---|
System.Exception | ex |
IsNotModified(Exception)
Declaration
public static bool IsNotModified(this Exception ex)
Returns
System.Boolean
Parameters
Type | Name |
---|
System.Exception | ex |
IsBadRequest(Exception)
Declaration
public static bool IsBadRequest(this Exception ex)
Returns
System.Boolean
Parameters
Type | Name |
---|
System.Exception | ex |
IsNotFound(Exception)
Declaration
public static bool IsNotFound(this Exception ex)
Returns
System.Boolean
Parameters
Type | Name |
---|
System.Exception | ex |
IsUnauthorized(Exception)
Declaration
public static bool IsUnauthorized(this Exception ex)
Returns
System.Boolean
Parameters
Type | Name |
---|
System.Exception | ex |
IsForbidden(Exception)
Declaration
public static bool IsForbidden(this Exception ex)
Returns
System.Boolean
Parameters
Type | Name |
---|
System.Exception | ex |
IsInternalServerError(Exception)
Declaration
public static bool IsInternalServerError(this Exception ex)
Returns
System.Boolean
Parameters
Type | Name |
---|
System.Exception | ex |
GetStatus(Exception)
Declaration
public static HttpStatusCode? GetStatus(this Exception ex)
Returns
System.Nullable<System.Net.HttpStatusCode>
Parameters
Type | Name |
---|
System.Exception | ex |
GetStatus(WebException)
Declaration
public static HttpStatusCode? GetStatus(this WebException webEx)
Returns
System.Nullable<System.Net.HttpStatusCode>
Parameters
Type | Name |
---|
System.Net.WebException | webEx |
HasStatus(Exception, HttpStatusCode)
Declaration
public static bool HasStatus(this Exception ex, HttpStatusCode statusCode)
Returns
System.Boolean
Parameters
Type | Name |
---|
System.Exception | ex |
System.Net.HttpStatusCode | statusCode |
GetResponseBody(Exception)
Declaration
public static string GetResponseBody(this Exception ex)
Returns
System.String
Parameters
Type | Name |
---|
System.Exception | ex |
GetResponseBodyAsync(Exception, CancellationToken)
Declaration
public static async Task<string> GetResponseBodyAsync(this Exception ex, CancellationToken token = default(CancellationToken))
Returns
System.Threading.Tasks.Task<System.String>
Parameters
Type | Name |
---|
System.Exception | ex |
System.Threading.CancellationToken | token |
ReadToEnd(WebResponse)
Declaration
public static string ReadToEnd(this WebResponse webRes)
Returns
System.String
Parameters
Type | Name |
---|
System.Net.WebResponse | webRes |
ReadToEndAsync(WebResponse)
Declaration
public static Task<string> ReadToEndAsync(this WebResponse webRes)
Returns
System.Threading.Tasks.Task<System.String>
Parameters
Type | Name |
---|
System.Net.WebResponse | webRes |
ReadLines(WebResponse)
Declaration
public static IEnumerable<string> ReadLines(this WebResponse webRes)
Returns
System.Collections.Generic.IEnumerable<System.String>
Parameters
Type | Name |
---|
System.Net.WebResponse | webRes |
GetJsonFromUrl(String, Action<HttpWebRequest>, Action<HttpWebResponse>)
Declaration
public static string GetJsonFromUrl(this string url, Action<HttpWebRequest> requestFilter = null, Action<HttpWebResponse> responseFilter = null)
Returns
System.String
Parameters
Type | Name |
---|
System.String | url |
System.Action<System.Net.HttpWebRequest> | requestFilter |
System.Action<System.Net.HttpWebResponse> | responseFilter |
GetJsonFromUrlAsync(String, Action<HttpWebRequest>, Action<HttpWebResponse>, CancellationToken)
Declaration
public static Task<string> GetJsonFromUrlAsync(this string url, Action<HttpWebRequest> requestFilter = null, Action<HttpWebResponse> responseFilter = null, CancellationToken token = default(CancellationToken))
Returns
System.Threading.Tasks.Task<System.String>
Parameters
Type | Name |
---|
System.String | url |
System.Action<System.Net.HttpWebRequest> | requestFilter |
System.Action<System.Net.HttpWebResponse> | responseFilter |
System.Threading.CancellationToken | token |
GetXmlFromUrl(String, Action<HttpWebRequest>, Action<HttpWebResponse>)
Declaration
public static string GetXmlFromUrl(this string url, Action<HttpWebRequest> requestFilter = null, Action<HttpWebResponse> responseFilter = null)
Returns
System.String
Parameters
Type | Name |
---|
System.String | url |
System.Action<System.Net.HttpWebRequest> | requestFilter |
System.Action<System.Net.HttpWebResponse> | responseFilter |
GetXmlFromUrlAsync(String, Action<HttpWebRequest>, Action<HttpWebResponse>, CancellationToken)
Declaration
public static Task<string> GetXmlFromUrlAsync(this string url, Action<HttpWebRequest> requestFilter = null, Action<HttpWebResponse> responseFilter = null, CancellationToken token = default(CancellationToken))
Returns
System.Threading.Tasks.Task<System.String>
Parameters
Type | Name |
---|
System.String | url |
System.Action<System.Net.HttpWebRequest> | requestFilter |
System.Action<System.Net.HttpWebResponse> | responseFilter |
System.Threading.CancellationToken | token |
GetCsvFromUrl(String, Action<HttpWebRequest>, Action<HttpWebResponse>)
Declaration
public static string GetCsvFromUrl(this string url, Action<HttpWebRequest> requestFilter = null, Action<HttpWebResponse> responseFilter = null)
Returns
System.String
Parameters
Type | Name |
---|
System.String | url |
System.Action<System.Net.HttpWebRequest> | requestFilter |
System.Action<System.Net.HttpWebResponse> | responseFilter |
GetCsvFromUrlAsync(String, Action<HttpWebRequest>, Action<HttpWebResponse>, CancellationToken)
Declaration
public static Task<string> GetCsvFromUrlAsync(this string url, Action<HttpWebRequest> requestFilter = null, Action<HttpWebResponse> responseFilter = null, CancellationToken token = default(CancellationToken))
Returns
System.Threading.Tasks.Task<System.String>
Parameters
Type | Name |
---|
System.String | url |
System.Action<System.Net.HttpWebRequest> | requestFilter |
System.Action<System.Net.HttpWebResponse> | responseFilter |
System.Threading.CancellationToken | token |
GetStringFromUrl(String, String, Action<HttpWebRequest>, Action<HttpWebResponse>)
Declaration
public static string GetStringFromUrl(this string url, string accept = "*/*", Action<HttpWebRequest> requestFilter = null, Action<HttpWebResponse> responseFilter = null)
Returns
System.String
Parameters
Type | Name |
---|
System.String | url |
System.String | accept |
System.Action<System.Net.HttpWebRequest> | requestFilter |
System.Action<System.Net.HttpWebResponse> | responseFilter |
GetStringFromUrlAsync(String, String, Action<HttpWebRequest>, Action<HttpWebResponse>, CancellationToken)
Declaration
public static Task<string> GetStringFromUrlAsync(this string url, string accept = "*/*", Action<HttpWebRequest> requestFilter = null, Action<HttpWebResponse> responseFilter = null, CancellationToken token = default(CancellationToken))
Returns
System.Threading.Tasks.Task<System.String>
Parameters
Type | Name |
---|
System.String | url |
System.String | accept |
System.Action<System.Net.HttpWebRequest> | requestFilter |
System.Action<System.Net.HttpWebResponse> | responseFilter |
System.Threading.CancellationToken | token |
PostStringToUrl(String, String, String, String, Action<HttpWebRequest>, Action<HttpWebResponse>)
Declaration
public static string PostStringToUrl(this string url, string requestBody = null, string contentType = null, string accept = "*/*", Action<HttpWebRequest> requestFilter = null, Action<HttpWebResponse> responseFilter = null)
Returns
System.String
Parameters
Type | Name |
---|
System.String | url |
System.String | requestBody |
System.String | contentType |
System.String | accept |
System.Action<System.Net.HttpWebRequest> | requestFilter |
System.Action<System.Net.HttpWebResponse> | responseFilter |
PostStringToUrlAsync(String, String, String, String, Action<HttpWebRequest>, Action<HttpWebResponse>, CancellationToken)
Declaration
public static Task<string> PostStringToUrlAsync(this string url, string requestBody = null, string contentType = null, string accept = "*/*", Action<HttpWebRequest> requestFilter = null, Action<HttpWebResponse> responseFilter = null, CancellationToken token = default(CancellationToken))
Returns
System.Threading.Tasks.Task<System.String>
Parameters
Type | Name |
---|
System.String | url |
System.String | requestBody |
System.String | contentType |
System.String | accept |
System.Action<System.Net.HttpWebRequest> | requestFilter |
System.Action<System.Net.HttpWebResponse> | responseFilter |
System.Threading.CancellationToken | token |
PostToUrl(String, String, String, Action<HttpWebRequest>, Action<HttpWebResponse>)
Declaration
public static string PostToUrl(this string url, string formData = null, string accept = "*/*", Action<HttpWebRequest> requestFilter = null, Action<HttpWebResponse> responseFilter = null)
Returns
System.String
Parameters
Type | Name |
---|
System.String | url |
System.String | formData |
System.String | accept |
System.Action<System.Net.HttpWebRequest> | requestFilter |
System.Action<System.Net.HttpWebResponse> | responseFilter |
PostToUrlAsync(String, String, String, Action<HttpWebRequest>, Action<HttpWebResponse>, CancellationToken)
Declaration
public static Task<string> PostToUrlAsync(this string url, string formData = null, string accept = "*/*", Action<HttpWebRequest> requestFilter = null, Action<HttpWebResponse> responseFilter = null, CancellationToken token = default(CancellationToken))
Returns
System.Threading.Tasks.Task<System.String>
Parameters
Type | Name |
---|
System.String | url |
System.String | formData |
System.String | accept |
System.Action<System.Net.HttpWebRequest> | requestFilter |
System.Action<System.Net.HttpWebResponse> | responseFilter |
System.Threading.CancellationToken | token |
PostToUrl(String, Object, String, Action<HttpWebRequest>, Action<HttpWebResponse>)
Declaration
public static string PostToUrl(this string url, object formData = null, string accept = "*/*", Action<HttpWebRequest> requestFilter = null, Action<HttpWebResponse> responseFilter = null)
Returns
System.String
Parameters
Type | Name |
---|
System.String | url |
System.Object | formData |
System.String | accept |
System.Action<System.Net.HttpWebRequest> | requestFilter |
System.Action<System.Net.HttpWebResponse> | responseFilter |
PostToUrlAsync(String, Object, String, Action<HttpWebRequest>, Action<HttpWebResponse>, CancellationToken)
Declaration
public static Task<string> PostToUrlAsync(this string url, object formData = null, string accept = "*/*", Action<HttpWebRequest> requestFilter = null, Action<HttpWebResponse> responseFilter = null, CancellationToken token = default(CancellationToken))
Returns
System.Threading.Tasks.Task<System.String>
Parameters
Type | Name |
---|
System.String | url |
System.Object | formData |
System.String | accept |
System.Action<System.Net.HttpWebRequest> | requestFilter |
System.Action<System.Net.HttpWebResponse> | responseFilter |
System.Threading.CancellationToken | token |
PostJsonToUrl(String, String, Action<HttpWebRequest>, Action<HttpWebResponse>)
Declaration
public static string PostJsonToUrl(this string url, string json, Action<HttpWebRequest> requestFilter = null, Action<HttpWebResponse> responseFilter = null)
Returns
System.String
Parameters
Type | Name |
---|
System.String | url |
System.String | json |
System.Action<System.Net.HttpWebRequest> | requestFilter |
System.Action<System.Net.HttpWebResponse> | responseFilter |
PostJsonToUrlAsync(String, String, Action<HttpWebRequest>, Action<HttpWebResponse>, CancellationToken)
Declaration
public static Task<string> PostJsonToUrlAsync(this string url, string json, Action<HttpWebRequest> requestFilter = null, Action<HttpWebResponse> responseFilter = null, CancellationToken token = default(CancellationToken))
Returns
System.Threading.Tasks.Task<System.String>
Parameters
Type | Name |
---|
System.String | url |
System.String | json |
System.Action<System.Net.HttpWebRequest> | requestFilter |
System.Action<System.Net.HttpWebResponse> | responseFilter |
System.Threading.CancellationToken | token |
PostJsonToUrl(String, Object, Action<HttpWebRequest>, Action<HttpWebResponse>)
Declaration
public static string PostJsonToUrl(this string url, object data, Action<HttpWebRequest> requestFilter = null, Action<HttpWebResponse> responseFilter = null)
Returns
System.String
Parameters
Type | Name |
---|
System.String | url |
System.Object | data |
System.Action<System.Net.HttpWebRequest> | requestFilter |
System.Action<System.Net.HttpWebResponse> | responseFilter |
PostJsonToUrlAsync(String, Object, Action<HttpWebRequest>, Action<HttpWebResponse>, CancellationToken)
Declaration
public static Task<string> PostJsonToUrlAsync(this string url, object data, Action<HttpWebRequest> requestFilter = null, Action<HttpWebResponse> responseFilter = null, CancellationToken token = default(CancellationToken))
Returns
System.Threading.Tasks.Task<System.String>
Parameters
Type | Name |
---|
System.String | url |
System.Object | data |
System.Action<System.Net.HttpWebRequest> | requestFilter |
System.Action<System.Net.HttpWebResponse> | responseFilter |
System.Threading.CancellationToken | token |
PostXmlToUrl(String, String, Action<HttpWebRequest>, Action<HttpWebResponse>)
Declaration
public static string PostXmlToUrl(this string url, string xml, Action<HttpWebRequest> requestFilter = null, Action<HttpWebResponse> responseFilter = null)
Returns
System.String
Parameters
Type | Name |
---|
System.String | url |
System.String | xml |
System.Action<System.Net.HttpWebRequest> | requestFilter |
System.Action<System.Net.HttpWebResponse> | responseFilter |
PostXmlToUrlAsync(String, String, Action<HttpWebRequest>, Action<HttpWebResponse>, CancellationToken)
Declaration
public static Task<string> PostXmlToUrlAsync(this string url, string xml, Action<HttpWebRequest> requestFilter = null, Action<HttpWebResponse> responseFilter = null, CancellationToken token = default(CancellationToken))
Returns
System.Threading.Tasks.Task<System.String>
Parameters
Type | Name |
---|
System.String | url |
System.String | xml |
System.Action<System.Net.HttpWebRequest> | requestFilter |
System.Action<System.Net.HttpWebResponse> | responseFilter |
System.Threading.CancellationToken | token |
PostCsvToUrl(String, String, Action<HttpWebRequest>, Action<HttpWebResponse>)
Declaration
public static string PostCsvToUrl(this string url, string csv, Action<HttpWebRequest> requestFilter = null, Action<HttpWebResponse> responseFilter = null)
Returns
System.String
Parameters
Type | Name |
---|
System.String | url |
System.String | csv |
System.Action<System.Net.HttpWebRequest> | requestFilter |
System.Action<System.Net.HttpWebResponse> | responseFilter |
PostCsvToUrlAsync(String, String, Action<HttpWebRequest>, Action<HttpWebResponse>, CancellationToken)
Declaration
public static Task<string> PostCsvToUrlAsync(this string url, string csv, Action<HttpWebRequest> requestFilter = null, Action<HttpWebResponse> responseFilter = null, CancellationToken token = default(CancellationToken))
Returns
System.Threading.Tasks.Task<System.String>
Parameters
Type | Name |
---|
System.String | url |
System.String | csv |
System.Action<System.Net.HttpWebRequest> | requestFilter |
System.Action<System.Net.HttpWebResponse> | responseFilter |
System.Threading.CancellationToken | token |
PutStringToUrl(String, String, String, String, Action<HttpWebRequest>, Action<HttpWebResponse>)
Declaration
public static string PutStringToUrl(this string url, string requestBody = null, string contentType = null, string accept = "*/*", Action<HttpWebRequest> requestFilter = null, Action<HttpWebResponse> responseFilter = null)
Returns
System.String
Parameters
Type | Name |
---|
System.String | url |
System.String | requestBody |
System.String | contentType |
System.String | accept |
System.Action<System.Net.HttpWebRequest> | requestFilter |
System.Action<System.Net.HttpWebResponse> | responseFilter |
PutStringToUrlAsync(String, String, String, String, Action<HttpWebRequest>, Action<HttpWebResponse>, CancellationToken)
Declaration
public static Task<string> PutStringToUrlAsync(this string url, string requestBody = null, string contentType = null, string accept = "*/*", Action<HttpWebRequest> requestFilter = null, Action<HttpWebResponse> responseFilter = null, CancellationToken token = default(CancellationToken))
Returns
System.Threading.Tasks.Task<System.String>
Parameters
Type | Name |
---|
System.String | url |
System.String | requestBody |
System.String | contentType |
System.String | accept |
System.Action<System.Net.HttpWebRequest> | requestFilter |
System.Action<System.Net.HttpWebResponse> | responseFilter |
System.Threading.CancellationToken | token |
PutToUrl(String, String, String, Action<HttpWebRequest>, Action<HttpWebResponse>)
Declaration
public static string PutToUrl(this string url, string formData = null, string accept = "*/*", Action<HttpWebRequest> requestFilter = null, Action<HttpWebResponse> responseFilter = null)
Returns
System.String
Parameters
Type | Name |
---|
System.String | url |
System.String | formData |
System.String | accept |
System.Action<System.Net.HttpWebRequest> | requestFilter |
System.Action<System.Net.HttpWebResponse> | responseFilter |
PutToUrlAsync(String, String, String, Action<HttpWebRequest>, Action<HttpWebResponse>, CancellationToken)
Declaration
public static Task<string> PutToUrlAsync(this string url, string formData = null, string accept = "*/*", Action<HttpWebRequest> requestFilter = null, Action<HttpWebResponse> responseFilter = null, CancellationToken token = default(CancellationToken))
Returns
System.Threading.Tasks.Task<System.String>
Parameters
Type | Name |
---|
System.String | url |
System.String | formData |
System.String | accept |
System.Action<System.Net.HttpWebRequest> | requestFilter |
System.Action<System.Net.HttpWebResponse> | responseFilter |
System.Threading.CancellationToken | token |
PutToUrl(String, Object, String, Action<HttpWebRequest>, Action<HttpWebResponse>)
Declaration
public static string PutToUrl(this string url, object formData = null, string accept = "*/*", Action<HttpWebRequest> requestFilter = null, Action<HttpWebResponse> responseFilter = null)
Returns
System.String
Parameters
Type | Name |
---|
System.String | url |
System.Object | formData |
System.String | accept |
System.Action<System.Net.HttpWebRequest> | requestFilter |
System.Action<System.Net.HttpWebResponse> | responseFilter |
PutToUrlAsync(String, Object, String, Action<HttpWebRequest>, Action<HttpWebResponse>, CancellationToken)
Declaration
public static Task<string> PutToUrlAsync(this string url, object formData = null, string accept = "*/*", Action<HttpWebRequest> requestFilter = null, Action<HttpWebResponse> responseFilter = null, CancellationToken token = default(CancellationToken))
Returns
System.Threading.Tasks.Task<System.String>
Parameters
Type | Name |
---|
System.String | url |
System.Object | formData |
System.String | accept |
System.Action<System.Net.HttpWebRequest> | requestFilter |
System.Action<System.Net.HttpWebResponse> | responseFilter |
System.Threading.CancellationToken | token |
PutJsonToUrl(String, String, Action<HttpWebRequest>, Action<HttpWebResponse>)
Declaration
public static string PutJsonToUrl(this string url, string json, Action<HttpWebRequest> requestFilter = null, Action<HttpWebResponse> responseFilter = null)
Returns
System.String
Parameters
Type | Name |
---|
System.String | url |
System.String | json |
System.Action<System.Net.HttpWebRequest> | requestFilter |
System.Action<System.Net.HttpWebResponse> | responseFilter |
PutJsonToUrlAsync(String, String, Action<HttpWebRequest>, Action<HttpWebResponse>, CancellationToken)
Declaration
public static Task<string> PutJsonToUrlAsync(this string url, string json, Action<HttpWebRequest> requestFilter = null, Action<HttpWebResponse> responseFilter = null, CancellationToken token = default(CancellationToken))
Returns
System.Threading.Tasks.Task<System.String>
Parameters
Type | Name |
---|
System.String | url |
System.String | json |
System.Action<System.Net.HttpWebRequest> | requestFilter |
System.Action<System.Net.HttpWebResponse> | responseFilter |
System.Threading.CancellationToken | token |
PutJsonToUrl(String, Object, Action<HttpWebRequest>, Action<HttpWebResponse>)
Declaration
public static string PutJsonToUrl(this string url, object data, Action<HttpWebRequest> requestFilter = null, Action<HttpWebResponse> responseFilter = null)
Returns
System.String
Parameters
Type | Name |
---|
System.String | url |
System.Object | data |
System.Action<System.Net.HttpWebRequest> | requestFilter |
System.Action<System.Net.HttpWebResponse> | responseFilter |
PutJsonToUrlAsync(String, Object, Action<HttpWebRequest>, Action<HttpWebResponse>, CancellationToken)
Declaration
public static Task<string> PutJsonToUrlAsync(this string url, object data, Action<HttpWebRequest> requestFilter = null, Action<HttpWebResponse> responseFilter = null, CancellationToken token = default(CancellationToken))
Returns
System.Threading.Tasks.Task<System.String>
Parameters
Type | Name |
---|
System.String | url |
System.Object | data |
System.Action<System.Net.HttpWebRequest> | requestFilter |
System.Action<System.Net.HttpWebResponse> | responseFilter |
System.Threading.CancellationToken | token |
PutXmlToUrl(String, String, Action<HttpWebRequest>, Action<HttpWebResponse>)
Declaration
public static string PutXmlToUrl(this string url, string xml, Action<HttpWebRequest> requestFilter = null, Action<HttpWebResponse> responseFilter = null)
Returns
System.String
Parameters
Type | Name |
---|
System.String | url |
System.String | xml |
System.Action<System.Net.HttpWebRequest> | requestFilter |
System.Action<System.Net.HttpWebResponse> | responseFilter |
PutXmlToUrlAsync(String, String, Action<HttpWebRequest>, Action<HttpWebResponse>, CancellationToken)
Declaration
public static Task<string> PutXmlToUrlAsync(this string url, string xml, Action<HttpWebRequest> requestFilter = null, Action<HttpWebResponse> responseFilter = null, CancellationToken token = default(CancellationToken))
Returns
System.Threading.Tasks.Task<System.String>
Parameters
Type | Name |
---|
System.String | url |
System.String | xml |
System.Action<System.Net.HttpWebRequest> | requestFilter |
System.Action<System.Net.HttpWebResponse> | responseFilter |
System.Threading.CancellationToken | token |
PutCsvToUrl(String, String, Action<HttpWebRequest>, Action<HttpWebResponse>)
Declaration
public static string PutCsvToUrl(this string url, string csv, Action<HttpWebRequest> requestFilter = null, Action<HttpWebResponse> responseFilter = null)
Returns
System.String
Parameters
Type | Name |
---|
System.String | url |
System.String | csv |
System.Action<System.Net.HttpWebRequest> | requestFilter |
System.Action<System.Net.HttpWebResponse> | responseFilter |
PutCsvToUrlAsync(String, String, Action<HttpWebRequest>, Action<HttpWebResponse>, CancellationToken)
Declaration
public static Task<string> PutCsvToUrlAsync(this string url, string csv, Action<HttpWebRequest> requestFilter = null, Action<HttpWebResponse> responseFilter = null, CancellationToken token = default(CancellationToken))
Returns
System.Threading.Tasks.Task<System.String>
Parameters
Type | Name |
---|
System.String | url |
System.String | csv |
System.Action<System.Net.HttpWebRequest> | requestFilter |
System.Action<System.Net.HttpWebResponse> | responseFilter |
System.Threading.CancellationToken | token |
PatchStringToUrl(String, String, String, String, Action<HttpWebRequest>, Action<HttpWebResponse>)
Declaration
public static string PatchStringToUrl(this string url, string requestBody = null, string contentType = null, string accept = "*/*", Action<HttpWebRequest> requestFilter = null, Action<HttpWebResponse> responseFilter = null)
Returns
System.String
Parameters
Type | Name |
---|
System.String | url |
System.String | requestBody |
System.String | contentType |
System.String | accept |
System.Action<System.Net.HttpWebRequest> | requestFilter |
System.Action<System.Net.HttpWebResponse> | responseFilter |
PatchStringToUrlAsync(String, String, String, String, Action<HttpWebRequest>, Action<HttpWebResponse>, CancellationToken)
Declaration
public static Task<string> PatchStringToUrlAsync(this string url, string requestBody = null, string contentType = null, string accept = "*/*", Action<HttpWebRequest> requestFilter = null, Action<HttpWebResponse> responseFilter = null, CancellationToken token = default(CancellationToken))
Returns
System.Threading.Tasks.Task<System.String>
Parameters
Type | Name |
---|
System.String | url |
System.String | requestBody |
System.String | contentType |
System.String | accept |
System.Action<System.Net.HttpWebRequest> | requestFilter |
System.Action<System.Net.HttpWebResponse> | responseFilter |
System.Threading.CancellationToken | token |
PatchToUrl(String, String, String, Action<HttpWebRequest>, Action<HttpWebResponse>)
Declaration
public static string PatchToUrl(this string url, string formData = null, string accept = "*/*", Action<HttpWebRequest> requestFilter = null, Action<HttpWebResponse> responseFilter = null)
Returns
System.String
Parameters
Type | Name |
---|
System.String | url |
System.String | formData |
System.String | accept |
System.Action<System.Net.HttpWebRequest> | requestFilter |
System.Action<System.Net.HttpWebResponse> | responseFilter |
PatchToUrlAsync(String, String, String, Action<HttpWebRequest>, Action<HttpWebResponse>, CancellationToken)
Declaration
public static Task<string> PatchToUrlAsync(this string url, string formData = null, string accept = "*/*", Action<HttpWebRequest> requestFilter = null, Action<HttpWebResponse> responseFilter = null, CancellationToken token = default(CancellationToken))
Returns
System.Threading.Tasks.Task<System.String>
Parameters
Type | Name |
---|
System.String | url |
System.String | formData |
System.String | accept |
System.Action<System.Net.HttpWebRequest> | requestFilter |
System.Action<System.Net.HttpWebResponse> | responseFilter |
System.Threading.CancellationToken | token |
PatchToUrl(String, Object, String, Action<HttpWebRequest>, Action<HttpWebResponse>)
Declaration
public static string PatchToUrl(this string url, object formData = null, string accept = "*/*", Action<HttpWebRequest> requestFilter = null, Action<HttpWebResponse> responseFilter = null)
Returns
System.String
Parameters
Type | Name |
---|
System.String | url |
System.Object | formData |
System.String | accept |
System.Action<System.Net.HttpWebRequest> | requestFilter |
System.Action<System.Net.HttpWebResponse> | responseFilter |
PatchToUrlAsync(String, Object, String, Action<HttpWebRequest>, Action<HttpWebResponse>, CancellationToken)
Declaration
public static Task<string> PatchToUrlAsync(this string url, object formData = null, string accept = "*/*", Action<HttpWebRequest> requestFilter = null, Action<HttpWebResponse> responseFilter = null, CancellationToken token = default(CancellationToken))
Returns
System.Threading.Tasks.Task<System.String>
Parameters
Type | Name |
---|
System.String | url |
System.Object | formData |
System.String | accept |
System.Action<System.Net.HttpWebRequest> | requestFilter |
System.Action<System.Net.HttpWebResponse> | responseFilter |
System.Threading.CancellationToken | token |
PatchJsonToUrl(String, String, Action<HttpWebRequest>, Action<HttpWebResponse>)
Declaration
public static string PatchJsonToUrl(this string url, string json, Action<HttpWebRequest> requestFilter = null, Action<HttpWebResponse> responseFilter = null)
Returns
System.String
Parameters
Type | Name |
---|
System.String | url |
System.String | json |
System.Action<System.Net.HttpWebRequest> | requestFilter |
System.Action<System.Net.HttpWebResponse> | responseFilter |
PatchJsonToUrlAsync(String, String, Action<HttpWebRequest>, Action<HttpWebResponse>, CancellationToken)
Declaration
public static Task<string> PatchJsonToUrlAsync(this string url, string json, Action<HttpWebRequest> requestFilter = null, Action<HttpWebResponse> responseFilter = null, CancellationToken token = default(CancellationToken))
Returns
System.Threading.Tasks.Task<System.String>
Parameters
Type | Name |
---|
System.String | url |
System.String | json |
System.Action<System.Net.HttpWebRequest> | requestFilter |
System.Action<System.Net.HttpWebResponse> | responseFilter |
System.Threading.CancellationToken | token |
PatchJsonToUrl(String, Object, Action<HttpWebRequest>, Action<HttpWebResponse>)
Declaration
public static string PatchJsonToUrl(this string url, object data, Action<HttpWebRequest> requestFilter = null, Action<HttpWebResponse> responseFilter = null)
Returns
System.String
Parameters
Type | Name |
---|
System.String | url |
System.Object | data |
System.Action<System.Net.HttpWebRequest> | requestFilter |
System.Action<System.Net.HttpWebResponse> | responseFilter |
PatchJsonToUrlAsync(String, Object, Action<HttpWebRequest>, Action<HttpWebResponse>, CancellationToken)
Declaration
public static Task<string> PatchJsonToUrlAsync(this string url, object data, Action<HttpWebRequest> requestFilter = null, Action<HttpWebResponse> responseFilter = null, CancellationToken token = default(CancellationToken))
Returns
System.Threading.Tasks.Task<System.String>
Parameters
Type | Name |
---|
System.String | url |
System.Object | data |
System.Action<System.Net.HttpWebRequest> | requestFilter |
System.Action<System.Net.HttpWebResponse> | responseFilter |
System.Threading.CancellationToken | token |
DeleteFromUrl(String, String, Action<HttpWebRequest>, Action<HttpWebResponse>)
Declaration
public static string DeleteFromUrl(this string url, string accept = "*/*", Action<HttpWebRequest> requestFilter = null, Action<HttpWebResponse> responseFilter = null)
Returns
System.String
Parameters
Type | Name |
---|
System.String | url |
System.String | accept |
System.Action<System.Net.HttpWebRequest> | requestFilter |
System.Action<System.Net.HttpWebResponse> | responseFilter |
DeleteFromUrlAsync(String, String, Action<HttpWebRequest>, Action<HttpWebResponse>, CancellationToken)
Declaration
public static Task<string> DeleteFromUrlAsync(this string url, string accept = "*/*", Action<HttpWebRequest> requestFilter = null, Action<HttpWebResponse> responseFilter = null, CancellationToken token = default(CancellationToken))
Returns
System.Threading.Tasks.Task<System.String>
Parameters
Type | Name |
---|
System.String | url |
System.String | accept |
System.Action<System.Net.HttpWebRequest> | requestFilter |
System.Action<System.Net.HttpWebResponse> | responseFilter |
System.Threading.CancellationToken | token |
OptionsFromUrl(String, String, Action<HttpWebRequest>, Action<HttpWebResponse>)
Declaration
public static string OptionsFromUrl(this string url, string accept = "*/*", Action<HttpWebRequest> requestFilter = null, Action<HttpWebResponse> responseFilter = null)
Returns
System.String
Parameters
Type | Name |
---|
System.String | url |
System.String | accept |
System.Action<System.Net.HttpWebRequest> | requestFilter |
System.Action<System.Net.HttpWebResponse> | responseFilter |
OptionsFromUrlAsync(String, String, Action<HttpWebRequest>, Action<HttpWebResponse>, CancellationToken)
Declaration
public static Task<string> OptionsFromUrlAsync(this string url, string accept = "*/*", Action<HttpWebRequest> requestFilter = null, Action<HttpWebResponse> responseFilter = null, CancellationToken token = default(CancellationToken))
Returns
System.Threading.Tasks.Task<System.String>
Parameters
Type | Name |
---|
System.String | url |
System.String | accept |
System.Action<System.Net.HttpWebRequest> | requestFilter |
System.Action<System.Net.HttpWebResponse> | responseFilter |
System.Threading.CancellationToken | token |
HeadFromUrl(String, String, Action<HttpWebRequest>, Action<HttpWebResponse>)
Declaration
public static string HeadFromUrl(this string url, string accept = "*/*", Action<HttpWebRequest> requestFilter = null, Action<HttpWebResponse> responseFilter = null)
Returns
System.String
Parameters
Type | Name |
---|
System.String | url |
System.String | accept |
System.Action<System.Net.HttpWebRequest> | requestFilter |
System.Action<System.Net.HttpWebResponse> | responseFilter |
HeadFromUrlAsync(String, String, Action<HttpWebRequest>, Action<HttpWebResponse>, CancellationToken)
Declaration
public static Task<string> HeadFromUrlAsync(this string url, string accept = "*/*", Action<HttpWebRequest> requestFilter = null, Action<HttpWebResponse> responseFilter = null, CancellationToken token = default(CancellationToken))
Returns
System.Threading.Tasks.Task<System.String>
Parameters
Type | Name |
---|
System.String | url |
System.String | accept |
System.Action<System.Net.HttpWebRequest> | requestFilter |
System.Action<System.Net.HttpWebResponse> | responseFilter |
System.Threading.CancellationToken | token |
SendStringToUrl(String, String, String, String, String, Action<HttpWebRequest>, Action<HttpWebResponse>)
Declaration
public static string SendStringToUrl(this string url, string method = null, string requestBody = null, string contentType = null, string accept = "*/*", Action<HttpWebRequest> requestFilter = null, Action<HttpWebResponse> responseFilter = null)
Returns
System.String
Parameters
Type | Name |
---|
System.String | url |
System.String | method |
System.String | requestBody |
System.String | contentType |
System.String | accept |
System.Action<System.Net.HttpWebRequest> | requestFilter |
System.Action<System.Net.HttpWebResponse> | responseFilter |
SendStringToUrlAsync(String, String, String, String, String, Action<HttpWebRequest>, Action<HttpWebResponse>, CancellationToken)
Declaration
public static async Task<string> SendStringToUrlAsync(this string url, string method = null, string requestBody = null, string contentType = null, string accept = "*/*", Action<HttpWebRequest> requestFilter = null, Action<HttpWebResponse> responseFilter = null, CancellationToken token = default(CancellationToken))
Returns
System.Threading.Tasks.Task<System.String>
Parameters
Type | Name |
---|
System.String | url |
System.String | method |
System.String | requestBody |
System.String | contentType |
System.String | accept |
System.Action<System.Net.HttpWebRequest> | requestFilter |
System.Action<System.Net.HttpWebResponse> | responseFilter |
System.Threading.CancellationToken | token |
SendStringToUrl(HttpWebRequest, String, String, String, String, Action<HttpWebRequest>, Action<HttpWebResponse>)
Declaration
public static string SendStringToUrl(this HttpWebRequest webReq, string method, string requestBody, string contentType, string accept, Action<HttpWebRequest> requestFilter, Action<HttpWebResponse> responseFilter)
Returns
System.String
Parameters
Type | Name |
---|
System.Net.HttpWebRequest | webReq |
System.String | method |
System.String | requestBody |
System.String | contentType |
System.String | accept |
System.Action<System.Net.HttpWebRequest> | requestFilter |
System.Action<System.Net.HttpWebResponse> | responseFilter |
SendStringToUrlAsync(HttpWebRequest, String, String, String, String, Action<HttpWebRequest>, Action<HttpWebResponse>)
Declaration
public static async Task<string> SendStringToUrlAsync(this HttpWebRequest webReq, string method, string requestBody, string contentType, string accept, Action<HttpWebRequest> requestFilter, Action<HttpWebResponse> responseFilter)
Returns
System.Threading.Tasks.Task<System.String>
Parameters
Type | Name |
---|
System.Net.HttpWebRequest | webReq |
System.String | method |
System.String | requestBody |
System.String | contentType |
System.String | accept |
System.Action<System.Net.HttpWebRequest> | requestFilter |
System.Action<System.Net.HttpWebResponse> | responseFilter |
GetBytesFromUrl(String, String, Action<HttpWebRequest>, Action<HttpWebResponse>)
Declaration
public static byte[] GetBytesFromUrl(this string url, string accept = "*/*", Action<HttpWebRequest> requestFilter = null, Action<HttpWebResponse> responseFilter = null)
Returns
System.Byte[]
Parameters
Type | Name |
---|
System.String | url |
System.String | accept |
System.Action<System.Net.HttpWebRequest> | requestFilter |
System.Action<System.Net.HttpWebResponse> | responseFilter |
GetBytesFromUrlAsync(String, String, Action<HttpWebRequest>, Action<HttpWebResponse>, CancellationToken)
Declaration
public static Task<byte[]> GetBytesFromUrlAsync(this string url, string accept = "*/*", Action<HttpWebRequest> requestFilter = null, Action<HttpWebResponse> responseFilter = null, CancellationToken token = default(CancellationToken))
Returns
System.Threading.Tasks.Task<System.Byte[]>
Parameters
Type | Name |
---|
System.String | url |
System.String | accept |
System.Action<System.Net.HttpWebRequest> | requestFilter |
System.Action<System.Net.HttpWebResponse> | responseFilter |
System.Threading.CancellationToken | token |
PostBytesToUrl(String, Byte[], String, String, Action<HttpWebRequest>, Action<HttpWebResponse>)
Declaration
public static byte[] PostBytesToUrl(this string url, byte[] requestBody = null, string contentType = null, string accept = "*/*", Action<HttpWebRequest> requestFilter = null, Action<HttpWebResponse> responseFilter = null)
Returns
System.Byte[]
Parameters
Type | Name |
---|
System.String | url |
System.Byte[] | requestBody |
System.String | contentType |
System.String | accept |
System.Action<System.Net.HttpWebRequest> | requestFilter |
System.Action<System.Net.HttpWebResponse> | responseFilter |
PostBytesToUrlAsync(String, Byte[], String, String, Action<HttpWebRequest>, Action<HttpWebResponse>, CancellationToken)
Declaration
public static Task<byte[]> PostBytesToUrlAsync(this string url, byte[] requestBody = null, string contentType = null, string accept = "*/*", Action<HttpWebRequest> requestFilter = null, Action<HttpWebResponse> responseFilter = null, CancellationToken token = default(CancellationToken))
Returns
System.Threading.Tasks.Task<System.Byte[]>
Parameters
Type | Name |
---|
System.String | url |
System.Byte[] | requestBody |
System.String | contentType |
System.String | accept |
System.Action<System.Net.HttpWebRequest> | requestFilter |
System.Action<System.Net.HttpWebResponse> | responseFilter |
System.Threading.CancellationToken | token |
PutBytesToUrl(String, Byte[], String, String, Action<HttpWebRequest>, Action<HttpWebResponse>)
Declaration
public static byte[] PutBytesToUrl(this string url, byte[] requestBody = null, string contentType = null, string accept = "*/*", Action<HttpWebRequest> requestFilter = null, Action<HttpWebResponse> responseFilter = null)
Returns
System.Byte[]
Parameters
Type | Name |
---|
System.String | url |
System.Byte[] | requestBody |
System.String | contentType |
System.String | accept |
System.Action<System.Net.HttpWebRequest> | requestFilter |
System.Action<System.Net.HttpWebResponse> | responseFilter |
PutBytesToUrlAsync(String, Byte[], String, String, Action<HttpWebRequest>, Action<HttpWebResponse>, CancellationToken)
Declaration
public static Task<byte[]> PutBytesToUrlAsync(this string url, byte[] requestBody = null, string contentType = null, string accept = "*/*", Action<HttpWebRequest> requestFilter = null, Action<HttpWebResponse> responseFilter = null, CancellationToken token = default(CancellationToken))
Returns
System.Threading.Tasks.Task<System.Byte[]>
Parameters
Type | Name |
---|
System.String | url |
System.Byte[] | requestBody |
System.String | contentType |
System.String | accept |
System.Action<System.Net.HttpWebRequest> | requestFilter |
System.Action<System.Net.HttpWebResponse> | responseFilter |
System.Threading.CancellationToken | token |
SendBytesToUrl(String, String, Byte[], String, String, Action<HttpWebRequest>, Action<HttpWebResponse>)
Declaration
public static byte[] SendBytesToUrl(this string url, string method = null, byte[] requestBody = null, string contentType = null, string accept = "*/*", Action<HttpWebRequest> requestFilter = null, Action<HttpWebResponse> responseFilter = null)
Returns
System.Byte[]
Parameters
Type | Name |
---|
System.String | url |
System.String | method |
System.Byte[] | requestBody |
System.String | contentType |
System.String | accept |
System.Action<System.Net.HttpWebRequest> | requestFilter |
System.Action<System.Net.HttpWebResponse> | responseFilter |
SendBytesToUrlAsync(String, String, Byte[], String, String, Action<HttpWebRequest>, Action<HttpWebResponse>, CancellationToken)
Declaration
public static async Task<byte[]> SendBytesToUrlAsync(this string url, string method = null, byte[] requestBody = null, string contentType = null, string accept = "*/*", Action<HttpWebRequest> requestFilter = null, Action<HttpWebResponse> responseFilter = null, CancellationToken token = default(CancellationToken))
Returns
System.Threading.Tasks.Task<System.Byte[]>
Parameters
Type | Name |
---|
System.String | url |
System.String | method |
System.Byte[] | requestBody |
System.String | contentType |
System.String | accept |
System.Action<System.Net.HttpWebRequest> | requestFilter |
System.Action<System.Net.HttpWebResponse> | responseFilter |
System.Threading.CancellationToken | token |
SendBytesToUrl(HttpWebRequest, String, Byte[], String, String, Action<HttpWebRequest>, Action<HttpWebResponse>)
Declaration
public static byte[] SendBytesToUrl(this HttpWebRequest webReq, string method, byte[] requestBody, string contentType, string accept, Action<HttpWebRequest> requestFilter, Action<HttpWebResponse> responseFilter)
Returns
System.Byte[]
Parameters
Type | Name |
---|
System.Net.HttpWebRequest | webReq |
System.String | method |
System.Byte[] | requestBody |
System.String | contentType |
System.String | accept |
System.Action<System.Net.HttpWebRequest> | requestFilter |
System.Action<System.Net.HttpWebResponse> | responseFilter |
SendBytesToUrlAsync(HttpWebRequest, String, Byte[], String, String, Action<HttpWebRequest>, Action<HttpWebResponse>, CancellationToken)
Declaration
public static async Task<byte[]> SendBytesToUrlAsync(this HttpWebRequest webReq, string method, byte[] requestBody, string contentType, string accept, Action<HttpWebRequest> requestFilter, Action<HttpWebResponse> responseFilter, CancellationToken token)
Returns
System.Threading.Tasks.Task<System.Byte[]>
Parameters
Type | Name |
---|
System.Net.HttpWebRequest | webReq |
System.String | method |
System.Byte[] | requestBody |
System.String | contentType |
System.String | accept |
System.Action<System.Net.HttpWebRequest> | requestFilter |
System.Action<System.Net.HttpWebResponse> | responseFilter |
System.Threading.CancellationToken | token |
GetStreamFromUrl(String, String, Action<HttpWebRequest>, Action<HttpWebResponse>)
Declaration
public static Stream GetStreamFromUrl(this string url, string accept = "*/*", Action<HttpWebRequest> requestFilter = null, Action<HttpWebResponse> responseFilter = null)
Returns
System.IO.Stream
Parameters
Type | Name |
---|
System.String | url |
System.String | accept |
System.Action<System.Net.HttpWebRequest> | requestFilter |
System.Action<System.Net.HttpWebResponse> | responseFilter |
GetStreamFromUrlAsync(String, String, Action<HttpWebRequest>, Action<HttpWebResponse>, CancellationToken)
Declaration
public static Task<Stream> GetStreamFromUrlAsync(this string url, string accept = "*/*", Action<HttpWebRequest> requestFilter = null, Action<HttpWebResponse> responseFilter = null, CancellationToken token = default(CancellationToken))
Returns
System.Threading.Tasks.Task<System.IO.Stream>
Parameters
Type | Name |
---|
System.String | url |
System.String | accept |
System.Action<System.Net.HttpWebRequest> | requestFilter |
System.Action<System.Net.HttpWebResponse> | responseFilter |
System.Threading.CancellationToken | token |
PostStreamToUrl(String, Stream, String, String, Action<HttpWebRequest>, Action<HttpWebResponse>)
Declaration
public static Stream PostStreamToUrl(this string url, Stream requestBody = null, string contentType = null, string accept = "*/*", Action<HttpWebRequest> requestFilter = null, Action<HttpWebResponse> responseFilter = null)
Returns
System.IO.Stream
Parameters
Type | Name |
---|
System.String | url |
System.IO.Stream | requestBody |
System.String | contentType |
System.String | accept |
System.Action<System.Net.HttpWebRequest> | requestFilter |
System.Action<System.Net.HttpWebResponse> | responseFilter |
PostStreamToUrlAsync(String, Stream, String, String, Action<HttpWebRequest>, Action<HttpWebResponse>, CancellationToken)
Declaration
public static Task<Stream> PostStreamToUrlAsync(this string url, Stream requestBody = null, string contentType = null, string accept = "*/*", Action<HttpWebRequest> requestFilter = null, Action<HttpWebResponse> responseFilter = null, CancellationToken token = default(CancellationToken))
Returns
System.Threading.Tasks.Task<System.IO.Stream>
Parameters
Type | Name |
---|
System.String | url |
System.IO.Stream | requestBody |
System.String | contentType |
System.String | accept |
System.Action<System.Net.HttpWebRequest> | requestFilter |
System.Action<System.Net.HttpWebResponse> | responseFilter |
System.Threading.CancellationToken | token |
PutStreamToUrl(String, Stream, String, String, Action<HttpWebRequest>, Action<HttpWebResponse>)
Declaration
public static Stream PutStreamToUrl(this string url, Stream requestBody = null, string contentType = null, string accept = "*/*", Action<HttpWebRequest> requestFilter = null, Action<HttpWebResponse> responseFilter = null)
Returns
System.IO.Stream
Parameters
Type | Name |
---|
System.String | url |
System.IO.Stream | requestBody |
System.String | contentType |
System.String | accept |
System.Action<System.Net.HttpWebRequest> | requestFilter |
System.Action<System.Net.HttpWebResponse> | responseFilter |
PutStreamToUrlAsync(String, Stream, String, String, Action<HttpWebRequest>, Action<HttpWebResponse>, CancellationToken)
Declaration
public static Task<Stream> PutStreamToUrlAsync(this string url, Stream requestBody = null, string contentType = null, string accept = "*/*", Action<HttpWebRequest> requestFilter = null, Action<HttpWebResponse> responseFilter = null, CancellationToken token = default(CancellationToken))
Returns
System.Threading.Tasks.Task<System.IO.Stream>
Parameters
Type | Name |
---|
System.String | url |
System.IO.Stream | requestBody |
System.String | contentType |
System.String | accept |
System.Action<System.Net.HttpWebRequest> | requestFilter |
System.Action<System.Net.HttpWebResponse> | responseFilter |
System.Threading.CancellationToken | token |
SendStreamToUrl(String, String, Stream, String, String, Action<HttpWebRequest>, Action<HttpWebResponse>)
Returns HttpWebResponse Stream which must be disposed
Declaration
public static Stream SendStreamToUrl(this string url, string method = null, Stream requestBody = null, string contentType = null, string accept = "*/*", Action<HttpWebRequest> requestFilter = null, Action<HttpWebResponse> responseFilter = null)
Returns
System.IO.Stream
Parameters
Type | Name |
---|
System.String | url |
System.String | method |
System.IO.Stream | requestBody |
System.String | contentType |
System.String | accept |
System.Action<System.Net.HttpWebRequest> | requestFilter |
System.Action<System.Net.HttpWebResponse> | responseFilter |
SendStreamToUrlAsync(String, String, Stream, String, String, Action<HttpWebRequest>, Action<HttpWebResponse>, CancellationToken)
Returns HttpWebResponse Stream which must be disposed
Declaration
public static async Task<Stream> SendStreamToUrlAsync(this string url, string method = null, Stream requestBody = null, string contentType = null, string accept = "*/*", Action<HttpWebRequest> requestFilter = null, Action<HttpWebResponse> responseFilter = null, CancellationToken token = default(CancellationToken))
Returns
System.Threading.Tasks.Task<System.IO.Stream>
Parameters
Type | Name |
---|
System.String | url |
System.String | method |
System.IO.Stream | requestBody |
System.String | contentType |
System.String | accept |
System.Action<System.Net.HttpWebRequest> | requestFilter |
System.Action<System.Net.HttpWebResponse> | responseFilter |
System.Threading.CancellationToken | token |
GetResponseStatus(String)
Declaration
public static HttpStatusCode? GetResponseStatus(this string url)
Returns
System.Nullable<System.Net.HttpStatusCode>
Parameters
GetErrorResponse(String)
Declaration
public static HttpWebResponse GetErrorResponse(this string url)
Returns
System.Net.HttpWebResponse
Parameters
GetErrorResponseAsync(String)
Declaration
public static async Task<HttpWebResponse> GetErrorResponseAsync(this string url)
Returns
System.Threading.Tasks.Task<System.Net.HttpWebResponse>
Parameters
UploadFile(WebRequest, Stream, String, String, String, Action<HttpWebRequest>, String, String)
Declaration
public static void UploadFile(this WebRequest webRequest, Stream fileStream, string fileName, string mimeType, string accept = null, Action<HttpWebRequest> requestFilter = null, string method = "POST", string field = "file")
Parameters
Type | Name |
---|
System.Net.WebRequest | webRequest |
System.IO.Stream | fileStream |
System.String | fileName |
System.String | mimeType |
System.String | accept |
System.Action<System.Net.HttpWebRequest> | requestFilter |
System.String | method |
System.String | field |
UploadFileAsync(WebRequest, Stream, String, String, String, Action<HttpWebRequest>, String, String, CancellationToken)
Declaration
public static async Task UploadFileAsync(this WebRequest webRequest, Stream fileStream, string fileName, string mimeType, string accept = null, Action<HttpWebRequest> requestFilter = null, string method = "POST", string field = "file", CancellationToken token = default(CancellationToken))
Returns
System.Threading.Tasks.Task
Parameters
Type | Name |
---|
System.Net.WebRequest | webRequest |
System.IO.Stream | fileStream |
System.String | fileName |
System.String | mimeType |
System.String | accept |
System.Action<System.Net.HttpWebRequest> | requestFilter |
System.String | method |
System.String | field |
System.Threading.CancellationToken | token |
UploadFile(WebRequest, Stream, String)
Declaration
public static void UploadFile(this WebRequest webRequest, Stream fileStream, string fileName)
Parameters
Type | Name |
---|
System.Net.WebRequest | webRequest |
System.IO.Stream | fileStream |
System.String | fileName |
UploadFileAsync(WebRequest, Stream, String, CancellationToken)
Declaration
public static async Task UploadFileAsync(this WebRequest webRequest, Stream fileStream, string fileName, CancellationToken token = default(CancellationToken))
Returns
System.Threading.Tasks.Task
Parameters
Type | Name |
---|
System.Net.WebRequest | webRequest |
System.IO.Stream | fileStream |
System.String | fileName |
System.Threading.CancellationToken | token |
PostXmlToUrl(String, Object, Action<HttpWebRequest>, Action<HttpWebResponse>)
Declaration
public static string PostXmlToUrl(this string url, object data, Action<HttpWebRequest> requestFilter = null, Action<HttpWebResponse> responseFilter = null)
Returns
System.String
Parameters
Type | Name |
---|
System.String | url |
System.Object | data |
System.Action<System.Net.HttpWebRequest> | requestFilter |
System.Action<System.Net.HttpWebResponse> | responseFilter |
PostCsvToUrl(String, Object, Action<HttpWebRequest>, Action<HttpWebResponse>)
Declaration
public static string PostCsvToUrl(this string url, object data, Action<HttpWebRequest> requestFilter = null, Action<HttpWebResponse> responseFilter = null)
Returns
System.String
Parameters
Type | Name |
---|
System.String | url |
System.Object | data |
System.Action<System.Net.HttpWebRequest> | requestFilter |
System.Action<System.Net.HttpWebResponse> | responseFilter |
PutXmlToUrl(String, Object, Action<HttpWebRequest>, Action<HttpWebResponse>)
Declaration
public static string PutXmlToUrl(this string url, object data, Action<HttpWebRequest> requestFilter = null, Action<HttpWebResponse> responseFilter = null)
Returns
System.String
Parameters
Type | Name |
---|
System.String | url |
System.Object | data |
System.Action<System.Net.HttpWebRequest> | requestFilter |
System.Action<System.Net.HttpWebResponse> | responseFilter |
PutCsvToUrl(String, Object, Action<HttpWebRequest>, Action<HttpWebResponse>)
Declaration
public static string PutCsvToUrl(this string url, object data, Action<HttpWebRequest> requestFilter = null, Action<HttpWebResponse> responseFilter = null)
Returns
System.String
Parameters
Type | Name |
---|
System.String | url |
System.Object | data |
System.Action<System.Net.HttpWebRequest> | requestFilter |
System.Action<System.Net.HttpWebResponse> | responseFilter |
PostFileToUrl(String, FileInfo, String, String, Action<HttpWebRequest>)
Declaration
public static WebResponse PostFileToUrl(this string url, FileInfo uploadFileInfo, string uploadFileMimeType, string accept = null, Action<HttpWebRequest> requestFilter = null)
Returns
System.Net.WebResponse
Parameters
Type | Name |
---|
System.String | url |
System.IO.FileInfo | uploadFileInfo |
System.String | uploadFileMimeType |
System.String | accept |
System.Action<System.Net.HttpWebRequest> | requestFilter |
PostFileToUrlAsync(String, FileInfo, String, String, Action<HttpWebRequest>, CancellationToken)
Declaration
public static async Task<WebResponse> PostFileToUrlAsync(this string url, FileInfo uploadFileInfo, string uploadFileMimeType, string accept = null, Action<HttpWebRequest> requestFilter = null, CancellationToken token = default(CancellationToken))
Returns
System.Threading.Tasks.Task<System.Net.WebResponse>
Parameters
Type | Name |
---|
System.String | url |
System.IO.FileInfo | uploadFileInfo |
System.String | uploadFileMimeType |
System.String | accept |
System.Action<System.Net.HttpWebRequest> | requestFilter |
System.Threading.CancellationToken | token |
PutFileToUrl(String, FileInfo, String, String, Action<HttpWebRequest>)
Declaration
public static WebResponse PutFileToUrl(this string url, FileInfo uploadFileInfo, string uploadFileMimeType, string accept = null, Action<HttpWebRequest> requestFilter = null)
Returns
System.Net.WebResponse
Parameters
Type | Name |
---|
System.String | url |
System.IO.FileInfo | uploadFileInfo |
System.String | uploadFileMimeType |
System.String | accept |
System.Action<System.Net.HttpWebRequest> | requestFilter |
PutFileToUrlAsync(String, FileInfo, String, String, Action<HttpWebRequest>, CancellationToken)
Declaration
public static async Task<WebResponse> PutFileToUrlAsync(this string url, FileInfo uploadFileInfo, string uploadFileMimeType, string accept = null, Action<HttpWebRequest> requestFilter = null, CancellationToken token = default(CancellationToken))
Returns
System.Threading.Tasks.Task<System.Net.WebResponse>
Parameters
Type | Name |
---|
System.String | url |
System.IO.FileInfo | uploadFileInfo |
System.String | uploadFileMimeType |
System.String | accept |
System.Action<System.Net.HttpWebRequest> | requestFilter |
System.Threading.CancellationToken | token |
UploadFile(WebRequest, FileInfo, String)
Declaration
public static WebResponse UploadFile(this WebRequest webRequest, FileInfo uploadFileInfo, string uploadFileMimeType)
Returns
System.Net.WebResponse
Parameters
Type | Name |
---|
System.Net.WebRequest | webRequest |
System.IO.FileInfo | uploadFileInfo |
System.String | uploadFileMimeType |
UploadFileAsync(WebRequest, FileInfo, String)
Declaration
public static async Task<WebResponse> UploadFileAsync(this WebRequest webRequest, FileInfo uploadFileInfo, string uploadFileMimeType)
Returns
System.Threading.Tasks.Task<System.Net.WebResponse>
Parameters
Type | Name |
---|
System.Net.WebRequest | webRequest |
System.IO.FileInfo | uploadFileInfo |
System.String | uploadFileMimeType |
DownloadFileTo(String, String, List<NameValue>)
Declaration
public static void DownloadFileTo(this string downloadUrl, string fileName, List<NameValue> headers = null)
Parameters
Type | Name |
---|
System.String | downloadUrl |
System.String | fileName |
System.Collections.Generic.List<ServiceStack.NameValue> | headers |
SetRange(HttpWebRequest, Int64, Nullable<Int64>)
Declaration
public static void SetRange(this HttpWebRequest request, long from, long? to)
Parameters
Type | Name |
---|
System.Net.HttpWebRequest | request |
System.Int64 | from |
System.Nullable<System.Int64> | to |
Declaration
public static void AddHeader(this HttpWebRequest res, string name, string value)
Parameters
Type | Name |
---|
System.Net.HttpWebRequest | res |
System.String | name |
System.String | value |
Declaration
public static string GetHeader(this HttpWebRequest res, string name)
Returns
System.String
Parameters
Type | Name |
---|
System.Net.HttpWebRequest | res |
System.String | name |
Declaration
public static string GetHeader(this HttpWebResponse res, string name)
Returns
System.String
Parameters
Type | Name |
---|
System.Net.HttpWebResponse | res |
System.String | name |
Declaration
public static HttpWebRequest WithHeader(this HttpWebRequest httpReq, string name, string value)
Returns
System.Net.HttpWebRequest
Parameters
Type | Name |
---|
System.Net.HttpWebRequest | httpReq |
System.String | name |
System.String | value |
With(HttpWebRequest, Action<HttpRequestConfig>)
Populate HttpRequestMessage with a simpler, untyped API
Syntax compatible with HttpClient's HttpRequestMessage
Declaration
public static HttpWebRequest With(this HttpWebRequest httpReq, Action<HttpRequestConfig> configure)
Returns
System.Net.HttpWebRequest
Parameters
Type | Name |
---|
System.Net.HttpWebRequest | httpReq |
System.Action<ServiceStack.HttpRequestConfig> | configure |