M
Michael Kremser
Hi NG!
I use the following code to get something from a webserver:
Uri uri = new Uri("http://www.mkcs.at/test/somedata.4s");
System.Net.WebRequest wr = System.Net.HttpWebRequest.Create(uri);
System.IO.Stream stream = wr.GetResponse().GetResponseStream();
int b;
string strResult = string.Empty;
while ((b=stream.ReadByte())!=-1)
{
strResult += System.Text.UTF7Encoding.UTF7.GetString(new byte[] {
(byte)b },0,1);
}
stream.Close();
return strResult;
However, these lines are not working correctly. It works two times, then
it hangs in line 3. If I comment out "stream.Close();", each even call
(2nd, 4th, 6th, and so on) fails with an error:
The protocol version is not supported
I do not have any idea what I could have done wrong.
Can anyone help me, please? Or is there any other possibility in getting
some data from a webserver (except a Web Service)?
Best regards,
Michael
--
How to contact me
~~~~~~~~~~~~~~~~~
directly via mail: remove the "NOTUSEABLE" and the point after it and
reverse the characters
via my portal: go to
http://great.dynu.com/tools/contact.4s?lang=de&ref=usenet
I use the following code to get something from a webserver:
Uri uri = new Uri("http://www.mkcs.at/test/somedata.4s");
System.Net.WebRequest wr = System.Net.HttpWebRequest.Create(uri);
System.IO.Stream stream = wr.GetResponse().GetResponseStream();
int b;
string strResult = string.Empty;
while ((b=stream.ReadByte())!=-1)
{
strResult += System.Text.UTF7Encoding.UTF7.GetString(new byte[] {
(byte)b },0,1);
}
stream.Close();
return strResult;
However, these lines are not working correctly. It works two times, then
it hangs in line 3. If I comment out "stream.Close();", each even call
(2nd, 4th, 6th, and so on) fails with an error:
The protocol version is not supported
I do not have any idea what I could have done wrong.
Can anyone help me, please? Or is there any other possibility in getting
some data from a webserver (except a Web Service)?
Best regards,
Michael
--
How to contact me
~~~~~~~~~~~~~~~~~
directly via mail: remove the "NOTUSEABLE" and the point after it and
reverse the characters
via my portal: go to
http://great.dynu.com/tools/contact.4s?lang=de&ref=usenet