Show / Hide Table of Contents

Method internet.formContent


Overload

Creates an HttpContent for posting web form fields with functions like System.Net.Http.HttpClient.PostAsync and ExtInternet.Post.

public static MultipartFormDataContent formContent(params (string name, object value)[] fields)
Parameters
fields  ((string name, object value)[])

One or more web form field names and values. See example.

Returns
MultipartFormDataContent
Exceptions
ArgumentException

An empty name.

Examples

var content = internet.formContent(("name1", "value1"), ("name2", "value2")).AddFile("name3", @"C:\Test\file.png");
string s = internet.http.Post("https://httpbin.org/anything", content).Text();