Hi I am trying to do proxies and I keep getting the above error

with the information you've provided all anyone is going to be able to tell you is that the connection is closing unexpectedly. I would guess you're using C# since you posted in the C# forum but I could be wrong since you haven't even provided that much information.

Ok I edited my posData and the sites I request to protect my code. I already have the proxy code implemented.

try
                    {
                        for (int i = 0; i < listBox4.Items.Count; i++)
                        {
                            listBox4.SetSelected(i, true);
                            listBox5.SetSelected(i, true);
                            listBox4.SelectedItem.ToString();
                            listBox2.SetSelected(i, true);

                            string[] details = { listBox4.SelectedItem.ToString(), listBox5.SelectedItem.ToString() };

                            foreach (string element in details)
                            {

                                

                                System.Net.ServicePointManager.Expect100Continue = false;

                                string postData = "";
                                HttpWebRequest request = (HttpWebRequest)WebRequest.Create("");
                                request.Proxy = new WebProxy("14.199.20.15:8909");
                                request.ContentType = "application/x-www-form-urlencoded";
                                request.ContentLength = postData.Length;
                                request.Method = "POST";
                                request.KeepAlive = true;


                                Stream requestStream = request.GetRequestStream();
                                byte[] postBytes = Encoding.ASCII.GetBytes(postData);
                                requestStream.Write(postBytes, 0, postBytes.Length);
                                requestStream.Close();
                                HttpWebResponse response = (HttpWebResponse)request.GetResponse();

                                StreamReader stream = new StreamReader(response.GetResponseStream());




                                string twitter = stream.ReadToEnd();
                                richTextBox1.Text = twitter;
                                webBrowser1.DocumentText = (richTextBox1.Text)


                                stream.Close();
                                stream.Dispose();



                            }
                        }
                    }

                    catch (Exception ex)
                    {

                        MessageBox.Show(ex.Message);

                    }

Edited 5 Years Ago by kytro360: n/a

This article has been dead for over six months. Start a new discussion instead.