首页 > 代码库 > c# http请求,获取非200时的响应体

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

 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时的响应体