通过http地址获取页面内容

            string ServiceIP = "http://117.79.81.82:9999/Design_Time_Addresses/FileServicesBLLContract/Service1/";



            WebResponse result = null;

            //要下载的地址

            WebRequest req = WebRequest.Create("http://www.seentaoedu.com:8080/soms4/web/ufida/scorm/getUserRightById.jsp?username=zhoujj");

            result = req.GetResponse();

            //读取到流

            Stream sr = result.GetResponseStream();

            Encoding encode = System.Text.Encoding.GetEncoding("GB2312");

            StreamReader strAddress = new StreamReader(sr, encode);

            //读取文件内容

            ServiceIP = strAddress.ReadToEnd().Trim();

  

你可能感兴趣的:(http)