fileName给的网址是http://localhost:8060/imageCode/image/ ,然后报不支持URI格式,如果写E://imageCode//image就没有问题,但是我是想把他下载到http://localhost:8060/imageCode/image/ 这个网站的路径下,而不是我本地的路径
public static bool SaveBinaryFile(WebResponse response, string FileName)
{
bool Value = true;
byte[] buffer = new byte[1024];
try
{
if (!Directory.Exists(FileName))
{
Directory.CreateDirectory(FileName);
}
Stream outStream = System.IO.File.Create(FileName + "/imageCode.png");
Stream inStream = response.GetResponseStream();
int l;
do
{
l = inStream.Read(buffer, 0, buffer.Length);
if (l > 0)
outStream.Write(buffer, 0, l);
}
while (l > 0);
outStream.Close();
inStream.Close();
}
catch
{
Value = false;
}
return Value;
}
public static bool SaveBinaryFile(WebResponse response, string FileName)
{
bool Value = true;
byte[] buffer = new byte[1024];
try
{
if (!Directory.Exists(FileName))
{
Directory.CreateDirectory(FileName);
}
Stream outStream = System.IO.File.Create(FileName + "/imageCode.png");
Stream inStream = response.GetResponseStream();
int l;
do
{
l = inStream.Read(buffer, 0, buffer.Length);
if (l > 0)
outStream.Write(buffer, 0, l);
}
while (l > 0);
outStream.Close();
inStream.Close();
}
catch
{
Value = false;
}
return Value;
}
解决方案 »
免费领取超大流量手机卡,每月29元包185G流量+100分钟通话, 中国电信官方发货