当前位置: 代码迷 >> ASP.NET >> 请问在winform调用webservice保存文件提示路径异常的解决办法
  详细解决方案

请问在winform调用webservice保存文件提示路径异常的解决办法

热度:6008   发布时间:2013-02-25 00:00:00.0
请教在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 对这个路径有写的权限吗?
  相关解决方案