Ejemplo n.º 1
0
        ///<summary>
        /// Adds passed arguments to the Url so that they can be processed by the targeted server.
        ///</summary>
        ///<param name="keyValueParameters">A <see cref="T:System.Collection.IDictionary"/> object containing key/value pairs that will be
        ///added to the request Url.</param>
        ///<returns>A <see cref="GETContent"/> object encapsulating key/value pairs formatted for a GET request. </returns>
        public static GETContent CreateGETParameterList(IDictionary keyValueParameters)
        {
            GETContent c = new GETContent();

            if (keyValueParameters == null || keyValueParameters.Count == 0)
            {
                return(c);
            }

            string lcontent = "?";
            int    counter  = 0;

            foreach (DictionaryEntry entry in keyValueParameters)
            {
                counter++;
                lcontent += entry.Key + "=" + entry.Value;

                if (counter != keyValueParameters.Count)
                {
                    lcontent += "&";
                }
            }

            c.stringContent = lcontent;
            return(c);
        }
Ejemplo n.º 2
0
        ///<summary>
        /// Adds arguments to the URL so that these can be processed by the targeted server.
        ///</summary>
        ///<param name="keyValueParameters">>A <see cref="T:System.Collection.IDictionary"/> object containing key/value pairs that will be
        ///added to the request Url.</param>
        ///<returns>A <see cref="DELETEContent"/> object encapsulating key/value pairs formatted for a DELETE request. </returns>
        public static DELETEContent CreateDELETEParameterList(IDictionary keyValueParameters)
        {
            GETContent    content = GETContent.CreateGETParameterList(keyValueParameters);
            DELETEContent del     = new DELETEContent();

            del.stringContent = content.stringContent;
            return(del);
        }
Ejemplo n.º 3
0
 /// <summary>
 /// Create an Http GET request.
 /// </summary>
 /// <param name="Url">The Url of the web server to which the request will be sent.</param>
 /// <param name="Content">The <see cref="GETContent"/> object to be sent to the Url.</param>
 /// <returns>An <see cref="HttpRequest"/> object that can be used to make GET request.</returns>
 public static HttpRequest CreateHttpGetRequest(string Url, GETContent Content)
 {
     return new HttpRequest(HttpRequest.RequestMethod.GET, Url, Content, null, null, null);
 }
Ejemplo n.º 4
0
 /// <summary>
 /// Create an Http GET request.
 /// </summary>
 /// <param name="url">The Url of the web server to which the request will be sent.</param>
 /// <param name="content">The <see cref="GETContent"/> object to be sent to the Url.</param>
 /// <returns>An <see cref="HttpRequest"/> object that can be used to make GET request.</returns>
 public static HttpRequest CreateHttpGetRequest(string url, GETContent content)
 {
     return(new HttpRequest(HttpRequest.RequestMethod.GET, url, content, null, null, null));
 }
Ejemplo n.º 5
0
        ///<summary>
        /// Adds passed arguments to the Url so that they can be processed by the targeted server. 
        ///</summary>
        ///<param name="keyValueParameters">A <see cref="T:System.Collection.IDictionary"/> object containing key/value pairs that will be 
        ///added to the request Url.</param>
        ///<returns>A <see cref="GETContent"/> object encapsulating key/value pairs formatted for a GET request. </returns>
        public static GETContent CreateGETParameterList(IDictionary keyValueParameters)
        {
            GETContent c = new GETContent();

            if (keyValueParameters == null || keyValueParameters.Count == 0)
            {
                return c;
            }

            string lcontent = "?";
            int counter = 0;

            foreach (DictionaryEntry entry in keyValueParameters)
            {
                counter++;
                lcontent += entry.Key + "=" + entry.Value;

                if (counter != keyValueParameters.Count)
                {
                    lcontent += "&";
                }
            }

            c.stringContent = lcontent;
            return c;
        }