"不支持给定路径的格式&QUOT。不支持、路径、格式、QUOT

2023-09-02 20:45:41 作者:剑指苍穹.

我给了code以下行的Web服务:

I gave following line of code on web service:

string str_uploadpath = Server.MapPath("/UploadBucket/Raw/");
FileStream objfilestream = new FileStream(str_uploadpath +
                fileName, FileMode.Create, FileAccess.ReadWrite);

能有一个人帮我这个错误消息的code 2线解决问题。

Can some one help me resolve issue with this error message from line 2 of the code.

不支持给定路径的格式。

The given path's format is not supported.

权限设置为完全访问每个人,这是实际路径文件夹中的文件夹中。 突破点给我的 str_uploadpath C:\ webprojects \ web服务\ UploadBucket \ \原料

Permission on the folder set to full access to everyone and it is actual path to the folder. break point gave me value of str_uploadpath as C:\webprojects\webservices\UploadBucket\Raw\.

什么是错的这个字符串我看不到。

What is wrong with this string I can not see.

推荐答案

而不是使用 str_uploadpath +文件名,请尝试使用的 System.IO.Path.Combine 来代替:

Rather than using str_uploadpath + fileName, try using System.IO.Path.Combine instead:

Path.Combine(str_uploadpath, fileName);

返回一个字符串。

which returns a string.

 
精彩推荐