“不支持给定路径的格式." [英] "The given path's format is not supported."
问题描述
我的网络服务中有以下代码:
I have the following code in my web service:
string str_uploadpath = Server.MapPath("/UploadBucket/Raw/");
FileStream objfilestream = new FileStream(str_uploadpath +
fileName, FileMode.Create, FileAccess.ReadWrite);
有人可以帮助我解决代码第 2 行中的此错误消息的问题.
Can someone help me resolve the issue with this error message from line 2 of the code.
不支持给定路径的格式.
The given path's format is not supported.
文件夹的权限设置为所有人的完全访问权限,它是文件夹的实际路径.
Permission on the folder is set to full access to everyone and it is the actual path to the folder.
断点给了我 str_uploadpath
的值为 C:\webprojects\webservices\UploadBucket\Raw\
.
The breakpoint gave me the value of str_uploadpath
as C:\webprojects\webservices\UploadBucket\Raw\
.
这个字符串有什么问题?
What is wrong with this string?
推荐答案
与其使用 str_uploadpath + fileName
,不如尝试使用 System.IO.Path.Combine
代替:
Rather than using str_uploadpath + fileName
, try using System.IO.Path.Combine
instead:
Path.Combine(str_uploadpath, fileName);
返回一个字符串.
这篇关于“不支持给定路径的格式."的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!