ASP.net得到当前路径 在类文件中得到当前根目录找到图片.... 解决方案 » 免费领取超大流量手机卡,每月29元包185G流量+100分钟通话, 中国电信官方发货 string dir = Server.MapPath("~/"); Server.MapPath()可以获取指定相对路径的物理路径 http://hi.baidu.com/qzdcj/blog/item/20f342dab5e49470d0164e0d.html 类里面需要使用 System.Web.HttpContext.Current.Server.MapPath("~") 用Server.MapPath()获取就可以了~~ Server.MapPath(Request.ServerVariables["PATH_INFO"])Server.MapPath("/")Server.MapPath("")Server.MapPath(".")Server.MapPath("../")Server.MapPath("..") Page.Request.ApplicationPath以上的代码在http://localhost/EnglishClub/manage/WebForm1.aspx页面运行结果:C:\Inetpub\wwwroot\EnglishClub\manage\WebForm1.aspxC:\Inetpub\wwwroot\C:\Inetpub\wwwroot\EnglishClub\manageC:\Inetpub\wwwroot\EnglishClub\manageC:\Inetpub\wwwroot\EnglishClub\C:\Inetpub\wwwroot\EnglishClub static string conn = "Provider=Microsoft.Jet.OleDb.4.0;Data Source = test.mdb";test.mdb放在根目录怎么得到.... 本帖最后由 net_lover 于 2011-08-15 12:01:13 编辑 IsMatch()正则表达式问题,高手进! js正则表达式匹配 初级 怎样判断DropDownList是否选择? DetailsView如何查找自身BoundField的值? 在博客内容的分页问题 推一下AJAX.NET实例 多行文本框 dataset 数据筛选 高手指点:ASP.NET能否实现自动登陆网站 第一次亲密接触iewebcontrols treeview没有点击事件吗不要selectindexchanged iframe
System.Web.HttpContext.Current.Server.MapPath("~")
Server.MapPath("/")
Server.MapPath("")
Server.MapPath(".")
Server.MapPath("../")
Server.MapPath("..")
Page.Request.ApplicationPath以上的代码在http://localhost/EnglishClub/manage/WebForm1.aspx页面
运行结果:
C:\Inetpub\wwwroot\EnglishClub\manage\WebForm1.aspx
C:\Inetpub\wwwroot\
C:\Inetpub\wwwroot\EnglishClub\manage
C:\Inetpub\wwwroot\EnglishClub\manage
C:\Inetpub\wwwroot\EnglishClub\
C:\Inetpub\wwwroot\EnglishClub
test.mdb放在根目录
怎么得到....