Form MultipartFormBoundary Property C# API
Gets or sets the string that will be used as the boundary between input elements (including the -- prefix), when encoding this Form as multipart/form-data.

Namespace: Facilita.Web
Assembly: clrWebBrowser (in clrWebBrowser.dll) Version: 9.4.0.26 (1.0.0.0)
Syntax

public string MultipartFormBoundary { get; set; }

Field Value

The string that will be used as the boundary between input elements (including the -- prefix), when encoding this Form as multipart/form-data.
Examples

The following example demonstrates setting the multipart form boundary.
// Populate form with data
Form form = previousResponse.ExtractForm("myForm");
form.GetInputElement("input1").Value = "value1";
form.GetFileElement("files-to-upload[]").AddFile("image.bmp", @"C:\dataFiles\image.bmp", "image/bmp");
form.GetFileElement("files-to-upload[]").AddFile("image2.bmp", @"C:\dataFiles\image2.bmp", "image/bmp");

// Set the multipart boundary for the form
form.MultipartFormBoundary = "--multipart-form-boundary";

// Send the POST request
Request request = WebBrowser.CreateRequest(HttpMethod.POST, myUrl);
request.SetMessageBody(form);
Response response = request.Send();
Examples

The following example demonstrates the contents of the POST request sent in the previous example.

The Content-Type header sent to the server will be Content-Type: multipart/form-data; boundary=multipart-form-boundary

--multipart-form-boundary
Content-Disposition: form-data; name="input1"

value1
--multipart-form-boundary
Content-Disposition: form-data; name="files-to-upload[]"
Content-Type: multipart/mixed; boundary=multipart-file-boundary

--multipart-file-boundary
Content-Disposition: file; filename="image.bmp"
Content-Type: image/bmp

(binary image data)
--multipart-file-boundary
Content-Disposition: file; filename="image2.bmp"
Content-Type: image/bmp

(binary image data)
--multipart-file-boundary--
--multipart-form-boundary--
Examples

The following example demonstrates getting the multipart form boundary.
form.getMultipartFormBoundary();
// This will return "--multipart-form-boundary"
See Also