The topic you requested is included in another documentation set. For convenience, it's displayed below. Choose Switch to see the topic in its original location.
FormPostHttpBody::FormPostParameters Property
Gets the list of FormPostParameters included in this FormPostHttpBody.
Assembly: Microsoft.VisualStudio.QualityTools.WebTestFramework (in Microsoft.VisualStudio.QualityTools.WebTestFramework.dll)
public: property FormPostParameterCollection^ FormPostParameters { FormPostParameterCollection^ get(); }
Property Value
Type: Microsoft.VisualStudio.TestTools.WebTesting::FormPostParameterCollection^A FormPostParameterCollection collection that contains each FormPostParameter associated with this FormPostHttpBody.
Legacy Code Example
The following code sample shows how a FormPostHttpBody adds form post parameters to the body of the WebTestRequest. The first form post parameter is adding viewstate information from a hidden field. The second and third parameters add the name and value attributes of the controls to the form post parameter collection.
namespace TestProject1 { using System; using System.Collections.Generic; using Microsoft.VisualStudio.TestTools.WebTesting; using Microsoft.VisualStudio.TestTools.WebTesting.Rules; public class MyCodedWebTest : WebTest { public override IEnumerator<WebTestRequest> GetRequestEnumerator() { WebTestRequest request1 = new WebTestRequest("http://localhost/MyWebSite"); request1.ThinkTime = 14; ExtractHiddenFields rule1 = new ExtractHiddenFields(); rule1.ContextParameterName = "1"; request1.ExtractValues += new EventHandler<ExtractionEventArgs>(rule1.Extract); yield return request1; WebTestRequest request2 = new WebTestRequest("http://localhost/MyWebSite/Default.aspx"); request2.Method = "POST"; FormPostHttpBody request2Body = new FormPostHttpBody(); request2Body.FormPostParameters.Add("__VIEWSTATE", "{{$HIDDEN1.__VIEWSTATE}}"); request2Body.FormPostParameters.Add("Button1", "Button"); request2Body.FormPostParameters.Add("TextBox1", "text entered"); request2.Body = request2Body; yield return request2; } } }
Show: