public void setTestLog(HttpWebRequest req, string respHtml) { if (testLog.InvokeRequired) { DSetTestLog sl = new DSetTestLog(delegate(HttpWebRequest req1, string text) { testLog.Text = Environment.NewLine + "返回的HTML源码:"; testLog.Text += Environment.NewLine + text; }); testLog.Invoke(sl, req, respHtml); } else { testLog.Text = Environment.NewLine + "返回的HTML源码:"; testLog.Text += Environment.NewLine + respHtml; } }
public void setTestLog(HttpWebRequest req, string respHtml) { if (log.InvokeRequired) { DSetTestLog sl = new DSetTestLog(delegate(HttpWebRequest req1, string text) { log.Text = Environment.NewLine + "返回的HTML源码:"; log.Text += Environment.NewLine + text; cookies.Text = "Token: " + gToken + Environment.NewLine; cookies.Text += "JSessionID: " + gJsessionid + Environment.NewLine; cookies.Text += "PaymentID: " + gPaymentID + Environment.NewLine; cookies.Text += Environment.NewLine; cookies.Text += "Cookies:" + Environment.NewLine; foreach (Cookie ck in req1.CookieContainer.GetCookies(req1.RequestUri)) { cookies.Text += ck + Environment.NewLine; } }); log.Invoke(sl, req, respHtml); } else { log.Text = Environment.NewLine + "返回的HTML源码:"; log.Text += Environment.NewLine + respHtml; cookies.Text = "Token: " + gToken + Environment.NewLine; cookies.Text += "JSessionID: " + gJsessionid + Environment.NewLine; cookies.Text += "PaymentID: " + gPaymentID + Environment.NewLine; cookies.Text += Environment.NewLine; cookies.Text += "Cookies:" + Environment.NewLine; foreach (Cookie ck in req.CookieContainer.GetCookies(req.RequestUri)) { cookies.Text += ck + Environment.NewLine; } } }