码迷,mamicode.com
首页 > Windows程序 > 详细

c# http请求,获取非200时的响应体

时间:2017-04-22 12:46:43      阅读:484      评论:0      收藏:0      [点我收藏+]

标签:null   new   nbsp   request   toe   string   adt   获取   try   

 HttpWebResponse res = null;
        try
        {
            res = request.GetResponse() as HttpWebResponse;

        }
        catch (WebException ex)
        {
            res = (HttpWebResponse)ex.Response;
            //string html = new StreamReader(temp.GetResponseStream()).ReadToEnd();
            //StreamReader sr = new StreamReader(res.GetResponseStream());
            //string html = sr.ReadToEnd();

        }

 

c# http请求,获取非200时的响应体

标签:null   new   nbsp   request   toe   string   adt   获取   try   

原文地址:http://www.cnblogs.com/gaocong/p/6747071.html

(0)
(0)
   
举报
评论 一句话评论(0
登录后才能评论!
© 2014 mamicode.com 版权所有  联系我们:gaon5@hotmail.com
迷上了代码!