WebsiteBuilder.HttpRequestOptions.SetPostData C# (CSharp) Méthode

SetPostData() public méthode

public SetPostData ( string>.IDictionary values ) : void
values string>.IDictionary
Résultat void
        public void SetPostData(IDictionary<string,string> values)
        {
            var strings = values.Keys.Select(key => string.Format("{0}={1}", key, values[key]));
            var postContent = string.Join("&", strings.ToArray());

            RequestContent = postContent;
            RequestContentType = "application/x-www-form-urlencoded";
        }

Usage Example

Exemple #1
0
        /// <summary>
        /// Performs a POST request
        /// </summary>
        /// <param name="options">The options.</param>
        /// <param name="postData">Params to add to the POST data.</param>
        /// <returns>stream on success, null on failure</returns>
        public async Task <Stream> Post(HttpRequestOptions options, Dictionary <string, string> postData)
        {
            options.SetPostData(postData);

            var response = await Post(options).ConfigureAwait(false);

            return(response.Content);
        }
All Usage Examples Of WebsiteBuilder.HttpRequestOptions::SetPostData