把方法封装到你的类中,编译一下吧!这段代码是从项目中提取出的简单一段。你使用的使用可能根据具体情况修改一下。 /// <summary> /// 执行POST请求,获娶验证码图片 /// </summary> /// <param name="localHost">Post请求的图片地址</param> /// <param name="referer">Referer地址</param> /// <returns>图片文件名称</returns> public string GetPostImage(string localHost,string referer) { Random rdFile = new Random(); string filename = rdFile.Next(9999).ToString() + ".png"; HttpWebRequest request = (HttpWebRequest)WebRequest.Create(localHost); request.Method = "GET"; request.ContentType = "image/png"; request.Referer = referer; HttpWebResponse response = (HttpWebResponse)request.GetResponse(); Fil