c#从网络读取验证码时出错
我本来想从网络上读取一个验证码显示在winform程序的一个picbox中 可是
/// 获取验证码方法
/// </summary>
public static Bitmap LoadImg(string ImageUrl)
{
try
{
HttpWebRequest wrq = (HttpWebRequest)WebRequest.Create(ImageUrl);//请求的URL
wrq.Method = "GET";
wrq.Timeout = 5000;
wrq.ContentType = "application/x-www-form-urlencoded";
//获取返回资源
HttpWebResponse response = (HttpWebResponse)wrq.GetResponse();
//获取流
Bitmap bt = Bitmap.FromStream(response.GetResponseStream()) as Bitmap;
return bt;
}
catch
{
return null;
}
}
pictureBox1.Load("http://captcha.qq.com/getimage?uin=88552244&aid=549000912&0.5529732842087849");