后台请求url数据

string strUrl = this.PicWebUrl+"cn/www/zh-chs/edushi/links/link.txt";//?rnd="+DateTime.Now;
                HttpWebRequest request = (HttpWebRequest)WebRequest.Create(strUrl);
                //获得响应流
                HttpWebResponse response = (HttpWebResponse)request.GetResponse();
                Stream ret = response.GetResponseStream();
                StreamReader sr = new StreamReader(ret, Encoding.GetEncoding("GB2312"));
                litContent.Text = sr.ReadToEnd();

 

posted @ 2013-01-21 11:39  百里水上  阅读(172)  评论(0编辑  收藏  举报