开发者

downloading file windows mobile 6.x

Hmm i tried to downlaod data from myurl/test.txt i find how to do that but codes below:

String forecastAdress = "myurl/test.txt";

            HttpWebRequest httpRequest = (HttpWebRequest)WebRequest.Create(forecastAdress);
            //httpRequest.Credentials = CredentialCache.DefaultCredentials;
            httpRequest.Credentials = CredentialCache.DefaultCredentials;
            HttpWebResponse httpResponse = (HttpWebResponse)开发者_开发百科httpRequest.GetResponse();

            System.IO.Stream dataStream = httpResponse.GetResponseStream();

            System.IO.StreamReader streamReader = new System.IO.StreamReader(dataStream);

            String forecastData = streamReader.ReadToEnd();
            listBox1.Text = forecastData;

            textBox1.Text = forecastData;
            streamReader.Close();
            httpResponse.Close();

but it occures error in

 System.IO.Stream dataStream = httpResponse.GetResponseStream();

Could not establish connection to network.

I'm wondering it is connection fail or something is wrong i code


Either the device doesn't have a connection to that particular host, or it doesn't have any connectivity at all.

I'm assuming that "myurl/test" is something you changed and isn't what you're actually passing to the device, because that's not a valid URL unless you've got custom DNS going on that makes it resolve.

0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜