就是验证码图片,怎么保存到本地,跪谢
解决方案 »
- 键盘事件,焦点问题
- C#的一个字符和整型转换的问题
- 问个简单问题.怎么不能启动.刚编了个程序,关了之后打开就不能调试了???
- 请问用TCPClient发送信息是否有二进制模式和ascii模式? 在线等
- 为什么我把字符串分割后会出现那么多\0,怎么去掉啊?
- VISUAL STUDIO 2005 与SQL2000发生的问题
- 我在DataGrid中加入了一个模板列,里面放入了CheckBox;一个绑定列ID;我如何获得选中了的记录的ID???
- 怎样才能让datetime字段去掉最后面的小时、分、秒??
- 求助; acptvc(微软全球技术中心 VC技术支持)
- 求高速秒杀思路
- EntityFrameWork 好让人抓狂阿
- Lambda表达式根据参数查询最接近的值
fs = new System.IO.FileStream(AppDomain.CurrentDomain.BaseDirectory + "\\images\\" + i.ToString() + ".jpg", System.IO.FileMode.CreateNew);
fs.Write(urlContents, 0, urlContents.Length);
给你举例,通过ReadAsByteArrayAsync获取所有的数据,然后通过File.WriteAllBytes写入本地文件
{
System.Net.WebClient web = new System.Net.WebClient();
web.DownloadFile(Url, Path);
}
以下示例代码.NET 2.0及以后版本都支持。
mode 1
------------------------------------------------------
WebClient webclient = new WebClient();
string bstrFileName = string.Empty;
string bstrUrlAddress = string.Empty;
webclient.DownloadFile(bstrUrlAddress, bstrFileName);
---------------------
mode 2
---------------------
WebClient webclient = new WebClient();
string bstrFileName = string.Empty;
string bstrUrlAddress = string.Empty;
File.WriteAllBytes(bstrFileName, webclient.DownloadData(bstrUrlAddress));
----------------------
mode 3
---------------------
WebClient webclient = new WebClient();
string bstrFileName = string.Empty;
string bstrUrlAddress = string.Empty;
webclient.DownloadDataCompleted += (sender, e) =>
{
if (!e.Cancelled && e.Error == null)
{
File.WriteAllBytes(bstrFileName, e.Result);
}
};
webclient.DownloadDataAsync(new Uri(bstrUrlAddress));
----------------------
mode 4
... ...
的特性 但一个好的建议是,你需要为工程假定一个绝对意义“运行时”
version and C# lang version
-----------------------------------------------------------------
通用定义:dotNET FRA 4.0 + C# 4.0
通用定义:dotNET FRA 2.0 + C# 2.0
-----------------------------
当你定义好了“运行库”的版本时,那么所有与此关联的开发人员
必须强制性的禁止使用任何脱离“限定”的API及语法。
注:不要使用到“dotNET”运行库中“obsolete”标注的成员。 不要试图向“云云大众”一般盲目的追求各种新的特性新的版本,
为什么要这么做? 它将为你带来诸如“统一开发环境,易于工程维护,易于工程迁
移,易于工程升级,减少语义混淆”等多个方面的好处。