亚洲乱码中文字幕综合,中国熟女仑乱hd,亚洲精品乱拍国产一区二区三区,一本大道卡一卡二卡三乱码全集资源,又粗又黄又硬又爽的免费视频

asp.net實(shí)現(xiàn)根據(jù)城市獲取天氣預(yù)報(bào)的方法

 更新時(shí)間:2015年12月04日 12:29:42   作者:happy664618843  
這篇文章主要介紹了asp.net實(shí)現(xiàn)根據(jù)城市獲取天氣預(yù)報(bào)的方法,涉及asp.net調(diào)用新浪接口獲取天氣預(yù)報(bào)信息的實(shí)現(xiàn)技巧,非常簡單實(shí)用,需要的朋友可以參考下

本文實(shí)例講述了asp.net實(shí)現(xiàn)根據(jù)城市獲取天氣預(yù)報(bào)的方法。分享給大家供大家參考,具體如下:

public void GetWetheaerByCity(string cityName) {
  string city = cityName;
  string mycity = HttpUtility.UrlEncode(city, System.Text.Encoding.GetEncoding("GB2312"));
  System.Net.HttpWebRequest request = (System.Net.HttpWebRequest)System.Net.WebRequest.Create("http://www.sina.com/index.php?city=" + cityName);
  //HttpWebRequest 對象 獲取GetResponse 轉(zhuǎn)換成HttpWebResponse
  System.Net.HttpWebResponse response = request.GetResponse() as System.Net.HttpWebResponse;
  //通過HttpWebResponse response.GetResponseStream()獲取輸出流
  Stream str = response.GetResponseStream();
  StreamReader reader = new StreamReader(str, System.Text.Encoding.GetEncoding("GB2312"));
  string weathhtml = reader.ReadToEnd();
  str.Close();
  reader.Close();
}

希望本文所述對大家asp.net程序設(shè)計(jì)有所幫助。

相關(guān)文章

最新評論