for (int i = this.cartDetail.Count - 1; i >= 0; i--) { //// Call api submit order using multiple thread this.threads[i] = new Thread(new ThreadStart(this.APISubmitOrder)); this.threads[i].Start(); this.threads[i].Name = i.ToString(new AcctNumberFormat()); this.threads[i].CurrentCulture = CultureInfo.CurrentCulture; this.threads[i].CurrentUICulture = CultureInfo.CurrentUICulture; } for (int i = this.cartDetail.Count - 1; i >= 0; i--) { //// join all thread this.threads[i].Join(); } private void APISubmitOrder() { ........ myHttpWebRequest = (HttpWebRequest)WebRequest.Create(strAPIURL); //// Encode the Post Data byte[] data = ASCIIEncoding.UTF8.GetBytes(strPostData.ToString()); myHttpWebRequest.Method = "POST"; myHttpWebRequest.ContentType = "application/x-www-form-urlencoded"; myHttpWebRequest.ContentLength = data.Length; myHttpWebRequest.KeepAlive = false; myHttpWebRequest.Timeout = 110000; strmrdRequest = myHttpWebRequest.GetRequestStream(); ////Send the Data strmrdRequest.Write(data, 0, data.Length); //// Get the http response myHttpResponse = myHttpWebRequest.GetResponse(); //// Get response stream strReadResponse = new StreamReader(myHttpResponse.GetResponseStream()); //// parse response string strReadResponseContent = strReadResponse.ReadToEnd(); ......... } in webconfig <httpRuntime maxRequestLength="1024" enable="true" executionTimeout="50000" />
var
This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)