G
Guest
I found a weird behavior of HttpWebRequest.GetResponse() in WM5
It raises exception if length of URL is around 2150. And also sends the data
to server successfully. Therefore, there is no way to detect that the data is
successfully received at server or not.
The error message is “Could not establish connection to network.†whereas
connection is completely ok.
The same code runs well from desktop application. I just copy past it there.
(In this code below I just modify the URL to google.com that's why if it
will work then there will be a web exception for error 400 range not the
connection error; so don't worry for 400 exception.)
string URL = new String('x', 2500);
URL = "http://www.google.com/" + URL;
URL = URL.Substring(0, 2084); // 2083 works great
HttpWebRequest request = (HttpWebRequest)WebRequest.Create(URL);
request.Method = "GET";
HttpWebResponse response = (HttpWebResponse)request.GetResponse(); //
exception!!!
StreamReader reader = new StreamReader(response.GetResponseStream(),
Encoding.UTF8);
string result = reader.ReadToEnd();
MessageBox.Show(result);
Any idea how I can send a larger string specifically using “GETS". I just
chage it to POST but it was also not working for this url
It raises exception if length of URL is around 2150. And also sends the data
to server successfully. Therefore, there is no way to detect that the data is
successfully received at server or not.
The error message is “Could not establish connection to network.†whereas
connection is completely ok.
The same code runs well from desktop application. I just copy past it there.
(In this code below I just modify the URL to google.com that's why if it
will work then there will be a web exception for error 400 range not the
connection error; so don't worry for 400 exception.)
string URL = new String('x', 2500);
URL = "http://www.google.com/" + URL;
URL = URL.Substring(0, 2084); // 2083 works great
HttpWebRequest request = (HttpWebRequest)WebRequest.Create(URL);
request.Method = "GET";
HttpWebResponse response = (HttpWebResponse)request.GetResponse(); //
exception!!!
StreamReader reader = new StreamReader(response.GetResponseStream(),
Encoding.UTF8);
string result = reader.ReadToEnd();
MessageBox.Show(result);
Any idea how I can send a larger string specifically using “GETS". I just
chage it to POST but it was also not working for this url