谁知道当我想要映射到webRoot上名为图像的文件夹时,如何设置DirectoryInfo的路径。/images
非常感谢您的帮助,谢谢
发布于 2009-02-13 08:12:28
如果您有相对于web应用程序的路径,则需要使用MapPath(...)来映射它方法。
在Page类中:
string fullyQualifiedFilename = Server.MapPath(relativeFilename);或者在页面类之外:
string fullyQualifiedFilename = HttpContext.Current.Server.MapPath(relativeFilename);发布于 2009-02-13 08:11:09
String virtualPath= "~\\images";
String RealPath=Server.MapPath(virtualPath); //it must be done at web application
System.IO.DirectoryInfo directory= new System.IO.DirectoryInfo(RealPath);发布于 2009-02-13 08:14:59
新镜像“DirectoryInfo(Path.Combine(Server.MapPath(Request.ApplicationPath),”));
https://stackoverflow.com/questions/545127
复制相似问题