|
楼主 |
发表于 2015-2-12 14:11:58
|
显示全部楼层
直接用的是你的代码额
HttpHelper http = new HttpHelper();
HttpItem item = new HttpItem()
{
URL = "http://www.sufeinet.com",//URL 必需项
Encoding = null,//编码格式(utf-8,gb2312,gbk) 可选项 默认类会自动识别
//Encoding = Encoding.Default,
ResultType = ResultType.Byte
};
//得到HTML代码
HttpResult result = http.GetHtml(item);
if (result.StatusCode == System.Net.HttpStatusCode.OK)
{
//表示访问成功,具体的大家就参考HttpStatusCode类
}
//表示StatusCode的文字说明与描述
string statusCodeDescription = result.StatusDescription;
//把得到的Byte转成图片
Image img = byteArrayToImage(result.ResultByte);
}
/// <summary>
/// 字节数组生成图片
/// </summary>
/// <param name="Bytes">字节数组</param>
/// <returns>图片</returns>
private Image byteArrayToImage(byte[] Bytes)
{
MemoryStream ms = new MemoryStream(Bytes);
Image outputImg = Image.FromStream(ms);
return outputImg;
} |
|