Jump to content

loveloli

Members
  • Posts

    1
  • Joined

  • Last visited

loveloli's Achievements

Newbie

Newbie (1/14)

0

Reputation

  1. Forgive my poor English I have a program that needs to access an external website but its port is not 80 but 10001 For example: eg.test.com:10001, but I found that the program can not connect, I also tried to access ordinary website: www.google.com operating normally So I would like to ask a solution Here is my part of the program: static public string Login(string LoginId, string PassWord) { HttpWebRequest Request = WebRequest.Create("http://eg.test.com:10001") as HttpWebRequest; Request.Method = "POST"; Request.KeepAlive = true; Request.ContentType = "application/x-www-form-urlencoded"; ASCIIEncoding Encoder = new ASCIIEncoding(); byte[] bytes = Encoder.GetBytes("login_id=" + LoginId + "&password=" + PassWord); Request.ContentLength = bytes.Length; Stream bw = Request.GetRequestStream(); bw.Write(bytes, 0, bytes.Length); bw.Flush(); bw.Close(); HttpWebResponse Response = Request.GetResponse() as HttpWebResponse; //DeflateStream ds = new DeflateStream(Response.GetResponseStream(), CompressionMode.Decompress); StreamReader sr = new StreamReader(Response.GetResponseStream(), Encoding.UTF8); string data = sr.ReadToEnd(); Response.Close(); return data; }
×
×
  • Create New...