string str = this.File1.PostedFile.FileName;
string ss = str.Substring(str .LastIndexOf ("\\")+1);
string s = Server.MapPath("..\\file\\" + ss); 这里提示用户代码未处理 invalidoperationexception 未能映射路径"/file/上传的文挡名"
path = "..\\file\\" + ss;
请各位达人帮帮忙啊!!!
string ss = str.Substring(str .LastIndexOf ("\\")+1);
string s = Server.MapPath("..\\file\\" + ss); 这里提示用户代码未处理 invalidoperationexception 未能映射路径"/file/上传的文挡名"
path = "..\\file\\" + ss;
请各位达人帮帮忙啊!!!
解决方案 »
- C# 调用批处理添加参数
- 谁可以给我一个些winform关于文件管理的源码?
- 求一正则表达式。在线等啊kk = @"(?s)(?=ArticleInsideAD\.js""></script></div>).*?(?=</TD>)";
- 诚心求教:如何在.NET应用程序和Win32应用程序之间进行数据传递?
- 哪里有.Net Compact Framework下c#+Access数据库编程的资料?
- 怎样知道PropertyGrid里某个GridItem的parent?(Up有分)
- 如何取得dynamic方法返回的linq中select new{}中的值?
- 请问如何编写具有相同方法名称但带有不同个数的参数的方法?
- 高分求解:Com+的实例化问题
- 两个窗口类传递信息?
- 关于防止重复启动的2个方法
- 求一正则的完全匹配
string str = this.File1.PostedFile.FileName;
string ss = str.Substring(str .LastIndexOf ("/")+1);
string s = Server.MapPath("../file/" + ss); 这里提示用户代码未处理 invalidoperationexception 未能映射路径"/file/上传的文挡名"
path = "../file/" + ss;
//例 Server.MapPath("/web/App_Code/XXX.cs");
string ss = str.Substring(str .LastIndexOf ("\\")+1);
string s = Server.MapPath("WebSitName /file\\" + ss);
path = "..\\file\\" + ss;
改成这样还是不行的,错误提示“用户代码未处理Httpexception”未能映射路径啊?
str是FILE1里的路径,SS是文件名,都有的,就是没有s
string ss = str.Substring(str .LastIndexOf ("//")+1);
string s = Server.MapPath("..//file//" + ss); 这里提示用户代码未处理 invalidoperationexception 未能映射路径"/file/上传的文挡名"
path = "..//file//" + ss;
如果你的file文件夹在站点根目录那么这样写就行了:
Server.MapPath("file/" + ss);
或者是
path = Server.MapPath("~/file/" + ss);
http://localhost:6668/NHWebPart/Default2.aspx
NHWebPart 的根目录:
E:\WorkSpace\DEMO\NHibernateStudy\NHWebPart
访问跟目录下的App_Data:
Server.MapPath( "App_Code" )
映射的物理路径:E:\WorkSpace\DEMO\NHibernateStudy\NHWebPart\App_Code
Server.MapPath( "App_Code/sss" )
映射的物理路径:E:\WorkSpace\DEMO\NHibernateStudy\NHWebPart\App_Code\sss (App_Code下是空的)
上面写的加 WebSitName 是不对的Server.MapPath("") 映射站点的跟目录,对应的物理路径就是E:\WorkSpace\DEMO\NHibernateStudy\NHWebPart\
不知道搂主现在明白没有
string s = Server.MapPath(newpath);