/// <summary> /// Called when no OnSubmit event is raised. /// </summary> /// <param name="sender"> The sender object.</param> /// <param name="e"> The FormHeuriscticEventArgs.</param> private void navForm_FormHeuristicEvent(object sender, FormHeuristicArgs e) { FormConverter converter = new FormConverter(); HtmlFormTag form = converter.AddPostDataValues(e.FormTag, e.PostData); if ( form.Action.Length == 0 ) { form.Action = e.SiteUri.Scheme + "://" + e.SiteUri.Authority + e.SiteUri.AbsolutePath; } RequestPostEventArgs postArgs = new RequestPostEventArgs(); // TODO: Check of Method is POST or GET // Just post postArgs.InspectorRequestAction = InspectorAction.WebBrowserPost; postArgs.Form = form; postArgs.Method = form.Method; postArgs.PostData = Encoding.UTF8.GetBytes(e.PostData); postArgs.CurrentUri = e.SiteUri; // request this.InspectorStartPostEvent(this, postArgs); // Add Easy Test options //this.RunQuickTests(postArgs); }
/// <summary> /// Occurs when post data is to match. /// </summary> /// <param name="data"></param> private void OnPostDataSubmitMatch(byte[] data) { // another event not from Form string postData = System.Text.Encoding.UTF8.GetString((byte[])data); if ( postData.IndexOf("Content-Disposition: form-data") > -1 ) { postData = formHeuristicEngine.FilterPostDataMultiPart(postData); HtmlFormTag formTag = formHeuristicEngine.MatchPostDataToForm(formCollection, postData); formTag = FormHeuristic.NormalizeFormTag(formTag, postData); FormHeuristicArgs args = new FormHeuristicArgs(); args.FormTag = formTag; args.PostData = postData; args.SiteUri = new Uri(this.web.LocationURL); FormHeuristicEvent(this, args); } else { HtmlFormTag formTag = formHeuristicEngine.MatchPostDataToForm(formCollection, postData); FormHeuristicArgs args = new FormHeuristicArgs(); args.FormTag = formTag; args.PostData = postData; args.SiteUri = new Uri(this.web.LocationURL); FormHeuristicEvent(this, args); } }