Jump to content

[Answered] Why Is My Asp.net Program Can Not Access Port 10001?


Recommended Posts

Posted

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;

}

Posted

I'm stuck In web.config settings, at least you can load website page...

 

can I look at your web.config?

 

Thanks.

 

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; }
Posted

Port 10001 is closed, if you need it open please let us know why and whether you can use another port that's already open instead.

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now
×
×
  • Create New...