asp.net 获取当前目录...

来源:互联网 发布:java 网上商城项目 编辑:程序博客网 时间:2024/05/22 03:34

方法一:

string sPath = System.IO.Path.GetDirectoryName(Page.Request.PhysicalPath)

方法二:

string sPath = System.Web.HttpContext.Current.Request.MapPath("images/")

                                                             //("images/")是当前虚拟目录下的任意目录

方法三:
string sPath = Page.Server.MapPath("images/");   //("images/")是当前虚拟目录下的任意目录

另:获取全路径中的文件名

string  sFile = System.IO.Path.GetFileName(sFile);

以上部分来源于internet... 
原创粉丝点击