c#获取远程图片文件流代码
/// <summary>
/// 获取图片流
/// </summary>
/// <param name="url">图片URL</param>
/// <returns></returns>
public static Stream GetRemoteImage(string url)
{
HttpWebRequest request = (HttpWebRequest)HttpWebRequest.Create(url);
request.Method = "GET";
request.ContentLength = 0;
request.Timeout = 20000;
HttpWebResponse response = null;
try
{
response = (HttpWebResponse)request.GetResponse();
return response.GetResponseStream();
}
catch
{
return null;
}
}
直接调用就好了.
上一篇: c#预处理指令
下一篇: 使用微信开放平台微信登录碰到的那些问题
相关文章
文章评论
热门评论
暂无评论


SVN提交时报:both sides of the move must be committed together.出现这个提示的时候,无论你怎么操作,就是提...
我在线文档一直以来用的是腾讯文档,上周打开一篇招商的文档,直接提示:此文档违反腾讯文档社区公约,暂时无...
“犊子”是一个神奇的东西,它可以滚、可以扯、可以护、可以完、可以瘪、可以装,还可以和王八配一起。
如果你的域名刚备案通过不满24小时,前往腾讯云CDN内容分发网络添加域名时,会提示: 域名未备案 :这是因为...
