日期:2014-05-18  浏览次数:20340 次

请教在winform调用webservice保存文件提示路径错误的解决方法
我的webservice是这样写的。
 [WebMethod]
  public void UpdateFile(byte[] content, string pathandname)
  {
  File.WriteAllBytes(Server.MapPath(pathandname), content);
  }

然后在winform中调用UpdateFile方法时,提示“未能找到保存的路径”,请问大家要如何解决。



------解决方案--------------------
判断下啊,没有那路径就先创建一个再保存
------解决方案--------------------
C# code

string path = Server.MapPath(pathandname);
if (File.Exists(path) == false)
{
  File.Create(path);
}

------解决方案--------------------
asp.net 对这个路径有写的权限吗?