/// <summary> /// Gets an instance of <see cref="IHttpQueryString"/> representing the GET parameters. /// </summary> public override IHttpQueryString GetQueryString() { // Convert the collection of fields to a string string fields = (Fields == null ? string.Empty : Fields.ToString()).Trim(); // Construct the query string IHttpQueryString query = base.GetQueryString(); if (string.IsNullOrWhiteSpace(BusinessId) == false) { query.Set("business_id", BusinessId); } if (IsBusiness != FacebookBoolean.Unspecified) { query.Set("is_business", IsBusiness); } if (IsPlace != FacebookBoolean.Unspecified) { query.Set("is_place", IsPlace); } if (IsPromotable != FacebookBoolean.Unspecified) { query.Set("is_promotable", IsPromotable); } if (string.IsNullOrWhiteSpace(fields) == false) { query.Set("fields", fields); } if (IncludeSummary) { query.Add("summary", "true"); } return(query); }
/// <summary> /// Generates a HMAC signature using the SHA256 hasing algorithm. /// </summary> /// <param name="endpoint">The endpoint.</param> /// <param name="parameters">The parameters.</param> /// <returns>The HMAC signature.</returns> /// <see> /// <cref>https://www.instagram.com/developer/secure-api-requests/#enforce-signed-requests</cref> /// </see> public string GenerateSignature(string endpoint, IHttpQueryString parameters) { // Some validation if (String.IsNullOrWhiteSpace(endpoint)) { throw new ArgumentNullException("endpoint"); } if (parameters == null) { throw new ArgumentNullException("parameters"); } if (String.IsNullOrWhiteSpace(ClientSecret)) { throw new PropertyNotSetException("ClientSecret"); } // Initialize the signature value string signatureValue = GenerateSignatureValue(endpoint, parameters); // The Instagram documentation doesn't explicitly mentain any // encoding, but the Python examples uses UTF-8 Encoding encoding = Encoding.UTF8; // Initialize the HMAC SHA256 hasher HMACSHA256 hasher = new HMACSHA256(encoding.GetBytes(ClientSecret)); // Generate the HMAC SHA256 hash byte[] hash = hasher.ComputeHash(encoding.GetBytes(signatureValue)); // Convert the hash back to a string return(BitConverter.ToString(hash).Replace("-", "").ToLower()); }
/// <summary> /// Initializes a new instance based on the specified <paramref name="client"/> and <paramref name="query"/>. /// </summary> /// <param name="client">The parent OAuth client.</param> /// <param name="query">The query string as specified by the response body.</param> protected OAuthAccessToken(OAuthClient client, IHttpQueryString query) { Client = client; Token = query["oauth_token"]; TokenSecret = query["oauth_token_secret"]; Query = query; }
/// <summary> /// Generates the signature value based on the specified <paramref name="endpoint"/> and /// <paramref name="parameters"/>. /// </summary> /// <param name="endpoint">The endpoint.</param> /// <param name="parameters">The parameters.</param> /// <returns>The signature value.</returns> /// <see> /// <cref>https://www.instagram.com/developer/secure-api-requests/#enforce-signed-requests</cref> /// </see> public string GenerateSignatureValue(string endpoint, IHttpQueryString parameters) { // Some validation if (String.IsNullOrWhiteSpace(endpoint)) { throw new ArgumentNullException("endpoint"); } if (parameters == null) { throw new ArgumentNullException("parameters"); } if (String.IsNullOrWhiteSpace(ClientSecret)) { throw new PropertyNotSetException("ClientSecret"); } // Initialize the signature value string signatureValue = endpoint; // Append the parameters (sorted by the key in alphabetic order) foreach (string key in parameters.Keys.OrderBy(x => x)) { signatureValue += "|" + key + "=" + parameters[key]; } return(signatureValue); }
/// <summary> /// Makes a PATCH request to the specified <paramref name="url"/>. /// </summary> /// <param name="url">The URL of the request.</param> /// <param name="queryString">The query string of the request.</param> /// <param name="postData">The POST data of the request.</param> /// <returns>An instance of <see cref="IHttpResponse"/> representing the response.</returns> public virtual IHttpResponse Patch(string url, IHttpQueryString queryString, IHttpPostData postData) { if (string.IsNullOrWhiteSpace(url)) { throw new ArgumentNullException(nameof(url)); } return(DoHttpRequest(HttpMethod.Patch, url, queryString, postData)); }
/// <summary> /// Parses a query string received from the API. /// </summary> /// <param name="client">The parent OAuth client.</param> /// <param name="str">The query string.</param> public new static TwitterOAuthAccessToken Parse(OAuthClient client, string str) { // Convert the query string to an IHttpQueryString IHttpQueryString query = HttpQueryString.ParseQueryString(str); // Initialize a new instance return(new TwitterOAuthAccessToken(client, query)); }
/// <summary> /// Makes a DELETE request to the specified <paramref name="url"/>. /// </summary> /// <param name="url">The URL of the request.</param> /// <param name="queryString">The query string of the request.</param> /// <returns>An instance of <see cref="IHttpResponse"/> representing the response.</returns> public static IHttpResponse Delete(string url, IHttpQueryString queryString) { if (string.IsNullOrWhiteSpace(url)) { throw new ArgumentNullException(nameof(url)); } return(DoHttpRequest(HttpMethod.Delete, url, queryString, null)); }
/// <summary> /// Sets the <see cref="IHttpRequest.QueryString"/> property of <paramref name="request"/>. /// </summary> /// <typeparam name="T">The type of the request - eg. <see cref="HttpRequest"/>.</typeparam> /// <param name="request">The request.</param> /// <param name="queryString">The new query string of the request.</param> /// <returns>The specified <paramref name="request"/> as an instance of <typeparamref name="T"/>.</returns> public static T SetQueryString <T>(this T request, IHttpQueryString queryString) where T : IHttpRequest { if (request != null) { request.QueryString = queryString; } return(request); }
/// <summary> /// Makes a GET request to the specified <paramref name="url"/>. /// </summary> /// <param name="url">The URL of the request.</param> /// <param name="queryString">The query string of the request.</param> /// <returns>An instance of <see cref="IHttpResponse"/> representing the response.</returns> public virtual IHttpResponse Get(string url, IHttpQueryString queryString) { if (string.IsNullOrWhiteSpace(url)) { throw new ArgumentNullException(nameof(url)); } return(DoHttpRequest(HttpMethod.Get, url, queryString)); }
/// <summary> /// Parses a query string received from the API. /// </summary> /// <param name="client">The parent OAuth client.</param> /// <param name="str">The query string.</param> public static OAuthRequestToken Parse(OAuthClient client, string str) { // Convert the query string to an IHttpQueryString IHttpQueryString query = HttpQueryString.ParseQueryString(str); // Initialize a new instance return(new OAuthRequestToken(client, query)); }
/// <summary> /// Initializes a new instance based on the specified <paramref name="client"/> and <paramref name="query"/>. /// </summary> /// <param name="client">The parent OAuth client.</param> /// <param name="query">The query string as specified by the response body.</param> protected SocialOAuthRequestToken(SocialOAuthClient client, IHttpQueryString query) { Client = client; Token = query["oauth_token"]; TokenSecret = query["oauth_token_secret"]; IsCallbackConfirmed = query["oauth_callback_confirmed"] == "true"; AuthorizeUrl = client.AuthorizeUrl + "?oauth_token=" + query["oauth_token"]; }
/// <summary> /// Makes a HTTP POST request based on the specified parameters. /// </summary> /// <param name="url">The base URL of the request (no query string).</param> /// <param name="queryString">The query string.</param> /// <param name="body">The body of the request.</param> /// <param name="formatting">The formatting to be used when serializing <paramref name="body"/>.</param> /// <returns>An instance of <see cref="IHttpResponse"/> representing the raw response.</returns> public virtual IHttpResponse Post(string url, IHttpQueryString queryString, JToken body, Formatting formatting) { if (body == null) { throw new ArgumentNullException(nameof(body)); } return(DoHttpRequest(HttpMethod.Post, url, queryString, body)); }
/// <summary> /// Makes a HTTP POST request based on the specified parameters. /// </summary> /// <param name="url">The base URL of the request (no query string).</param> /// <param name="queryString">The query string.</param> /// <param name="body">The body of the request.</param> /// <param name="options">The options to be used when serializing <paramref name="body"/>.</param> /// <returns>An instance of <see cref="IHttpResponse"/> representing the raw response.</returns> public virtual IHttpResponse Post(string url, IHttpQueryString queryString, XNode body, SaveOptions options) { if (body == null) { throw new ArgumentNullException(nameof(body)); } return(DoHttpRequest(HttpMethod.Post, url, queryString, body, options)); }
/// <summary> /// Parses a query string received from the API. /// </summary> /// <param name="client">The parent OAuth client.</param> /// <param name="str">The query string.</param> public static SocialOAuthAccessToken Parse(SocialOAuthClient client, string str) { // Convert the query string to an IHttpQueryString IHttpQueryString query = SocialHttpQueryString.ParseQueryString(str); // Initialize a new instance return(new SocialOAuthAccessToken(client, query)); }
/// <summary> /// Makes a GET request to the specified <paramref name="url"/>. /// </summary> /// <param name="url">The URL of the request.</param> /// <param name="queryString">The query string of the request.</param> /// <returns>An instance of <see cref="SocialHttpResponse"/> representing the response.</returns> public static SocialHttpResponse DoHttpGetRequest(string url, IHttpQueryString queryString) { if (String.IsNullOrWhiteSpace(url)) { throw new ArgumentNullException(nameof(url)); } return(DoHttpRequest(SocialHttpMethod.Get, url, queryString)); }
/// <summary> /// Parses a query string received from the API. /// </summary> /// <param name="client">The parent OAuth client.</param> /// <param name="str">The query string.</param> public new static OAuthRequestToken Parse(OAuthClient client, string str) { // Convert the query string to a NameValueCollection IHttpQueryString query = HttpQueryString.ParseQueryString(str); // Initialize a new instance return(new TwitterOAuthRequestToken(client, query)); }
/// <summary> /// Makes a PATCH request to the specified <paramref name="url"/>. /// </summary> /// <param name="url">The URL of the request.</param> /// <param name="queryString">The query string of the request.</param> /// <param name="postData">The PATCH data of the request.</param> /// <returns>An instance of <see cref="SocialHttpResponse"/> representing the response.</returns> public static SocialHttpResponse DoHttpPatchRequest(string url, IHttpQueryString queryString, IHttpPostData postData) { if (String.IsNullOrWhiteSpace(url)) { throw new ArgumentNullException(nameof(url)); } return(DoHttpRequest(SocialHttpMethod.Patch, url, queryString, postData)); }
private static void parseQueryStringValue(IHttpQueryString queryString, string value) { if (!string.IsNullOrEmpty(value)) { string[] values = value.Split('='); queryString.Add(values[0], values.Length > 1 ? values[1] : string.Empty); } }
/// <summary> /// Initializes a new exception based on the specified <paramref name="response"/>. /// </summary> /// <param name="response">The instance of <see cref="IHttpResponse"/> representing the raw response.</param> public MeetupOAuthException(IHttpResponse response) : base(response) { if (response.ContentType.StartsWith("application/x-www-form-urlencoded")) { IHttpQueryString query = HttpQueryString.ParseQueryString(response.Body); Problem = query["oauth_problem"]; } }
/// <summary> /// Generates the string value used for making the signature. /// </summary> /// <param name="method">The method for the HTTP request.</param> /// <param name="url">The URL of the request.</param> /// <param name="queryString">The query string.</param> /// <param name="body">The POST data.</param> /// <returns>The generated signature value.</returns> public virtual string GenerateSignatureValue(HttpMethod method, string url, IHttpQueryString queryString, IHttpPostData body) { return(string.Format( "{0}&{1}&{2}", method.ToString().ToUpper(), EscapeDataString(url.Split('#')[0].Split('?')[0]), EscapeDataString(GenerateParameterString(queryString, body)) )); }
protected override void ExecuteMain(IHttpContext httpContext) { IHttpQueryString httpQueryString = httpContext.Request.QueryString; if (httpQueryString.Contains("key-name") && httpQueryString.Contains("value")) { string keyName = httpQueryString["key-name"].FirstOrDefault() ?? "value"; string value = httpQueryString["value"].FirstOrDefault() ?? string.Empty; httpContext.Flash[keyName] = value; } }
/// <summary> /// Makes a POST request to the specified <paramref name="url"/> and JSON <paramref name="body"/>. /// </summary> /// <param name="url">The URL of the request.</param> /// <param name="queryString">The query string of the request.</param> /// <param name="body">The <see cref="JToken"/> representing the POST body.</param> /// <returns>An instance of <see cref="IHttpResponse"/> representing the response.</returns> public static IHttpResponse Post(string url, IHttpQueryString queryString, JToken body) { if (string.IsNullOrWhiteSpace(url)) { throw new ArgumentNullException(nameof(url)); } if (body == null) { throw new ArgumentNullException(nameof(body)); } return(new HttpRequest(HttpMethod.Post, url, queryString, body).GetResponse()); }
/// <summary> /// Initializes a new instance based on the specified <paramref name="client"/> and <paramref name="query"/>. /// </summary> /// <param name="client">The parent OAuth client.</param> /// <param name="query">The query string as specified by the response body.</param> protected SocialOAuthAccessToken(SocialOAuthClient client, IHttpQueryString query) { Client = client; // Get the user ID long userId; Int64.TryParse(query["user_id"], out userId); // Populate the properties Token = query["oauth_token"]; TokenSecret = query["oauth_token_secret"]; Query = query; }
/// <summary> /// Gets an instance of <see cref="IHttpQueryString"/> representing the GET parameters. /// </summary> public override IHttpQueryString GetQueryString() { IHttpQueryString query = base.GetQueryString(); if (!String.IsNullOrWhiteSpace(Query)) { query.Add("query", query); } if (Sort != VimeoVideoSortField.Default) { query.Add("sort", StringUtils.ToUnderscore(Sort)); query.Add("direction", Direction == VimeoSortDirection.Ascending ? "asc" : "desc"); } return(query); }
/// <summary> /// Gets an instance of <see cref="IHttpQueryString"/> representing the GET parameters. /// </summary> public override IHttpQueryString GetQueryString() { // Get the query string IHttpQueryString query = base.GetQueryString(); // Convert the collection of fields to a string string fields = (Fields == null ? "" : Fields.ToString()).Trim(); // Update the query string if (!String.IsNullOrWhiteSpace(fields)) { query.Set("fields", fields); } return(query); }
/// <summary> /// Generates the the string of parameters used for making the signature. /// </summary> /// <param name="queryString">Values representing the query string.</param> /// <param name="body">Values representing the POST body.</param> /// <returns>The generated parameter string.</returns> public virtual string GenerateParameterString(IHttpQueryString queryString, IHttpPostData body) { // The parameters must be alphabetically sorted SortedDictionary <string, string> sorted = new SortedDictionary <string, string>(); // Add parameters from the query string if (queryString != null) { foreach (string key in queryString.Keys) { //if (key.StartsWith("oauth_")) continue; sorted.Add(Uri.EscapeDataString(key), Uri.EscapeDataString(queryString[key])); } } // Add parameters from the POST data if (body != null) { foreach (string key in body.Keys) { //if (key.StartsWith("oauth_")) continue; sorted.Add(Uri.EscapeDataString(key), Uri.EscapeDataString(body[key])); } } // Add OAuth values if (!String.IsNullOrEmpty(Callback)) { sorted.Add("oauth_callback", Uri.EscapeDataString(Callback)); } sorted.Add("oauth_consumer_key", Uri.EscapeDataString(ConsumerKey)); sorted.Add("oauth_nonce", Uri.EscapeDataString(Nonce)); sorted.Add("oauth_signature_method", "HMAC-SHA1"); sorted.Add("oauth_timestamp", Uri.EscapeDataString(Timestamp)); if (!String.IsNullOrEmpty(Token)) { sorted.Add("oauth_token", Uri.EscapeDataString(Token)); } sorted.Add("oauth_version", Uri.EscapeDataString(Version)); // Merge all parameters return(sorted.Aggregate("", (current, pair) => current + ("&" + pair.Key + "=" + pair.Value)).Substring(1)); }
/// <summary> /// Gets an instance of <see cref="IHttpQueryString"/> representing the GET parameters. /// </summary> public override IHttpQueryString GetQueryString() { // Get the query string IHttpQueryString query = base.GetQueryString(); // Convert the collection of fields to a string string fields = (Fields == null ? string.Empty : Fields.ToString()).Trim(); // Update the query string if (string.IsNullOrWhiteSpace(fields) == false) { query.Set("fields", fields); } if (IncludeHidden) { query.Add("include_hidden", "true"); } return(query); }
protected override IResult ExecuteMain(IHttpContext httpContext, List <PositionedResult> childResults) { IHttpQueryString httpQueryString = httpContext.Request.QueryString; if (httpQueryString.Contains("key-name")) { string keyName = httpQueryString["key-name"].FirstOrDefault() ?? "value"; return(new SimpleResult { Content = new SimpleContent { BodyContent = httpContext.Session[keyName] } }); } return(new SimpleResult { Content = new SimpleContent { BodyContent = "Key Not Found" } }); }
/// <summary> /// Gets an instance of <see cref="IHttpQueryString"/> representing the GET parameters. /// </summary> public override IHttpQueryString GetQueryString() { IHttpQueryString query = base.GetQueryString(); // Convert the collection of fields to a string string fields = (Fields == null ? "" : Fields.ToString()).Trim(); // Construct the query string if (!String.IsNullOrWhiteSpace(fields)) { query.Set("fields", fields); } if (IncludeSummary) { query.Set("summary", "true"); } // TODO: Implement the "filter" modifier return(query); }
/// <summary> /// Gets an instance of <see cref="IHttpQueryString"/> representing the GET parameters. /// </summary> public override IHttpQueryString GetQueryString() { // Get the query string IHttpQueryString query = base.GetQueryString(); // Convert the collection of fields to a string string fields = (Fields == null ? string.Empty : Fields.ToString()).Trim(); // Update the query string if (IncludeCanceled) { query.Add("include_canceled", "true"); } if (Type != FacebookEventRsvpStatus.All) { query.Add("type", StringUtils.ToUnderscore(Type)); } if (string.IsNullOrWhiteSpace(fields) == false) { query.Set("fields", fields); } return(query); }
/// <summary> /// Makes a POST request to the specified <code>url</code>. /// </summary> /// <param name="url">The base URL of the request (no query string).</param> /// <param name="queryString">The query string.</param> /// <returns>Returns an instance of <see cref="SocialHttpResponse"/> representing the raw response.</returns> public static SocialHttpResponse DoHttpPostRequest(string url, IHttpQueryString queryString) { return DoHttpRequest(SocialHttpMethod.Post, url, queryString, null); }
/// <summary> /// Makes a GET request to the specified <code>url</code>. /// </summary> /// <param name="url">The URL of the request.</param> /// <param name="queryString">The query string of the request.</param> /// <returns>Returns an instance of <see cref="SocialHttpResponse"/> representing the response.</returns> public virtual SocialHttpResponse DoHttpGetRequest(string url, IHttpQueryString queryString) { if (String.IsNullOrWhiteSpace(url)) throw new ArgumentNullException("url"); return DoHttpRequest(SocialHttpMethod.Get, url, queryString); }
/// <summary> /// Makes a HTTP request to the underlying API based on the specified parameters. /// </summary> /// <param name="method">The HTTP method of the request.</param> /// <param name="url">The base URL of the request (no query string).</param> /// <param name="queryString">The query string.</param> /// <param name="postData">The POST data.</param> /// <returns>Returns an instance of <see cref="SocialHttpResponse"/> representing the raw response.</returns> public virtual SocialHttpResponse DoHttpRequest(SocialHttpMethod method, string url, IHttpQueryString queryString, IHttpPostData postData) { // Some input validation if (String.IsNullOrWhiteSpace(url)) throw new ArgumentNullException("url"); if (queryString == null) queryString = new SocialHttpQueryString(); if (postData == null) postData = new SocialHttpPostData(); // Initialize the request SocialHttpRequest request = new SocialHttpRequest { Method = method, Url = url, QueryString = queryString, PostData = postData }; PrepareHttpRequest(request); // Make the call to the URL return request.GetResponse(); }
/// <summary> /// Makes a HTTP request to the underlying API based on the specified parameters. /// </summary> /// <param name="method">The HTTP method of the request.</param> /// <param name="url">The base URL of the request (no query string).</param> /// <param name="queryString">The query string.</param> /// <returns>Returns an instance of <see cref="SocialHttpResponse"/> representing the raw response.</returns> public virtual SocialHttpResponse DoHttpRequest(SocialHttpMethod method, string url, IHttpQueryString queryString) { return DoHttpRequest(method, url, queryString, null); }
/// <summary> /// Generates the the string of parameters used for making the signature. /// </summary> /// <param name="queryString">Values representing the query string.</param> /// <param name="body">Values representing the POST body.</param> /// <returns>Returns the generated parameter string.</returns> public virtual string GenerateParameterString(IHttpQueryString queryString, IHttpPostData body) { // The parameters must be alphabetically sorted SortedDictionary<string, string> sorted = new SortedDictionary<string, string>(); // Add parameters from the query string if (queryString != null) { foreach (string key in queryString.Keys) { //if (key.StartsWith("oauth_")) continue; sorted.Add(Uri.EscapeDataString(key), Uri.EscapeDataString(queryString[key])); } } // Add parameters from the POST data if (body != null) { foreach (string key in body.Keys) { //if (key.StartsWith("oauth_")) continue; sorted.Add(Uri.EscapeDataString(key), Uri.EscapeDataString(body[key])); } } // Add OAuth values if (!String.IsNullOrEmpty(Callback)) sorted.Add("oauth_callback", Uri.EscapeDataString(Callback)); sorted.Add("oauth_consumer_key", Uri.EscapeDataString(ConsumerKey)); sorted.Add("oauth_nonce", Uri.EscapeDataString(Nonce)); sorted.Add("oauth_signature_method", "HMAC-SHA1"); sorted.Add("oauth_timestamp", Uri.EscapeDataString(Timestamp)); if (!String.IsNullOrEmpty(Token)) sorted.Add("oauth_token", Uri.EscapeDataString(Token)); sorted.Add("oauth_version", Uri.EscapeDataString(Version)); // Merge all parameters return sorted.Aggregate("", (current, pair) => current + ("&" + pair.Key + "=" + pair.Value)).Substring(1); }
/// <summary> /// Generate the signature. /// </summary> /// <param name="method">The method for the HTTP request.</param> /// <param name="url">The URL of the request.</param> /// <param name="queryString">The query string.</param> /// <param name="body">The POST data.</param> /// <returns>Returns the generated signature.</returns> public virtual string GenerateSignature(SocialHttpMethod method, string url, IHttpQueryString queryString, IHttpPostData body) { HMACSHA1 hasher = new HMACSHA1(new ASCIIEncoding().GetBytes(GenerateSignatureKey())); return Convert.ToBase64String(hasher.ComputeHash(new ASCIIEncoding().GetBytes(GenerateSignatureValue(method, url, queryString, body)))); }
/// <summary> /// Makes a POST request to the specified <code>url</code>. /// </summary> /// <param name="url">The URL of the request.</param> /// <param name="queryString">The query string of the request.</param> /// <param name="postData">The POST data of the request.</param> /// <returns>Returns an instance of <see cref="SocialHttpResponse"/> representing the response.</returns> public static SocialHttpResponse DoHttpPostRequest(string url, IHttpQueryString queryString, IHttpPostData postData) { if (String.IsNullOrWhiteSpace(url)) throw new ArgumentNullException("url"); return DoHttpRequest(SocialHttpMethod.Post, url, queryString, postData); }
/// <summary> /// Generates the string value used for making the signature. /// </summary> /// <param name="method">The method for the HTTP request.</param> /// <param name="url">The URL of the request.</param> /// <param name="queryString">The query string.</param> /// <param name="body">The POST data.</param> /// <returns>Returns the generated signature value.</returns> public virtual string GenerateSignatureValue(SocialHttpMethod method, string url, IHttpQueryString queryString, IHttpPostData body) { return String.Format( "{0}&{1}&{2}", method.ToString().ToUpper(), Uri.EscapeDataString(url.Split('#')[0].Split('?')[0]), Uri.EscapeDataString(GenerateParameterString(queryString, body)) ); }
/// <summary> /// Makes a HTTP request using the specified <code>url</code> and <code>method</code>. /// </summary> /// <param name="url">The URL of the request.</param> /// <param name="method">The HTTP method of the request.</param> /// <param name="queryString">The query string of the request.</param> /// <param name="postData">The POST data of the request.</param> /// <returns>Returns an instance of <see cref="SocialHttpResponse"/> representing the response.</returns> private static SocialHttpResponse DoHttpRequest(SocialHttpMethod method, string url, IHttpQueryString queryString, IHttpPostData postData) { // Initialize the request SocialHttpRequest request = new SocialHttpRequest { Url = url, Method = method, QueryString = queryString, PostData = postData }; // Make the call to the URL return request.GetResponse(); }