|
楼主 |
发表于 2014-11-5 10:23:46
|
显示全部楼层
我对C# 不是很熟 那可以 这样子 try catch 一下 ,然后可以解决这个问题不? 谢谢
try
{
result.StatusCode = response.StatusCode;
//获取StatusDescription
result.StatusDescription = response.StatusDescription;
//获取Headers
result.Header = response.Headers;
//获取CookieCollection
if (response.Cookies != null) result.CookieCollection = response.Cookies;
//获取set-cookie
if (response.Headers["set-cookie"] != null) result.Cookie = response.Headers["set-cookie"];
#endregion
#region byte
//处理网页Byte
byte[] ResponseByte = GetByte();
#endregion
#region Html
if (ResponseByte != null & ResponseByte.Length > 0)
{
//设置编码
SetEncoding(item, result, ResponseByte);
//得到返回的HTML
result.Html = encoding.GetString(ResponseByte);
}
else
{
//没有返回任何Html代码
result.Html = string.Empty;
}
#endregion
}
catch { result.Html = string.Empty; }
finally { }
|
|