1
A
回答
3
如果你有相对于你的web应用程序的路径,你需要用MapPath方法(...)方法映射。
在页类:
string fullyQualifiedFilename = Server.MapPath(relativeFilename);
或页面类以外:
string fullyQualifiedFilename = HttpContext.Current.Server.MapPath(relativeFilename);
2
String virtualPath= "~\\images";
String RealPath=Server.MapPath(virtualPath); //it must be done at web application
System.IO.DirectoryInfo directory= new System.IO.DirectoryInfo(RealPath);
1
新DirectoryInfo的(Path.Combine(使用Server.Mappath(Request.ApplicationPath), “图像”) );
相关问题
- 1. 将DirectoryInfo与UNC路径一起使用
- 2. DirectoryInfo,FileInfo和很长的路径
- 3. .NET路径组合
- 4. 长路径在.NET
- 5. 结合一个DirectoryInfo和一个FileInfo路径
- 6. DirectoryInfo Create()方法不需要传递目录路径?
- 7. 如何通过Directoryinfo获取最新文件的完整路径
- 8. 我可以使用DirectoryInfo解析DFS路径吗?
- 9. Server.MapPath()返回与DirectoryInfo一起使用时不存在的路径
- 10. .net DirectoryInfo通配符排除模式
- 11. 路径解析器在.NET
- 12. .NET路径操作库
- 13. ASP .NET无效路径
- 14. .NET中的相对路径
- 15. .NET更改临时路径
- 16. var di = new DirectoryInfo(路径)抛出异常,直到我使用Windows资源管理器第一次打开路径
- 17. DirectoryInfo在正确的路径中抛出“参数异常:路径不是合法形式”
- 18. 如何将DOS路径转换为正常路径(.net)
- 19. 使用DirectoryInfo时可以使用引号括起路径的其他方法?
- 20. c#为什么当路径是“C:”directoryInfo带我到应用程序文件夹?
- 21. 奇怪的.NET路径错误
- 22. .NET Windows Service的相对路径问题..?
- 23. 获取.NET Framework目录路径
- 24. 路径出错,YUI压缩机.NET
- 25. ASP .NET C#得到在网络路径
- 26. 如何确定.NET中exlorer.exe的路径?
- 27. .Net Web API与路径不匹配
- 28. .NET中编译的相对路径
- 29. .NET LDAP路径实用程序(C#)
- 30. 无法映射路径'/'。 .net 4.0
是的,多数民众赞成在文件夹被命名为图像,相对于我的应用程序它是../images 我会使用../images作为relativeFileName吗?非常感谢。 – user17510 2009-02-13 08:16:39