欢迎来到天天文库
浏览记录
ID:18424006
大小:124.00 KB
页数:7页
时间:2018-09-17
《server.mappath()获取本机绝对路径》由会员上传分享,免费在线阅读,更多相关内容在工程资料-天天文库。
1、Server.MapPath()获取本机绝对路径1.Server.MapPath("/") 应用程序根目录所在的位置如C:Inetpubwwwroot2.Server.MapPath("./") 表示所在页面的当前目录 注:等价于Server.MapPath("") 返回Server.MapPath("")所在页面的物理文件路径3.Server.MapPath("../")表示上一级目录4.Server.MapPath("~/")表示当前应用级程序的目录,如果是根目录,就是根目录,如果是虚拟目录,就是
2、虚拟目录所在的位置如:C:InetpubwwwrootExample注:等效于Server.MapPath("~")。不知道是否正确,研究中......另:以下几句等效Java代码1.string filename=Server.MapPath("./") + @"Web.config"; 2.string filename=Server.MapPath("./") + "/Web.config"; 3.string filename=Server.MapPath("") + @"Web.con
3、fig" stringfilename=Server.MapPath("./")+@"Web.config";stringfilename=Server.MapPath("./")+"/Web.config";stringfilename=Server.MapPath("")+@"Web.config" 附一例子:修改web.config的某一节点的属性值Java代码1.public void write() 2. { 3. string key1 = this.T
4、extBox1.Text; 4. DataSet ds = new DataSet(); 5. ds.ReadXml(Server.MapPath("")+"/web.config"); 6. // 不是Tables[0] 7. ds.Tables[1].Rows[0][1] = key1; 8. ds.AcceptChanges(); 9. ds.WriteXml(S
5、erver.MapPath("")+"/web.config"); 10. ds.Dispose(); 11. 12. } publicvoidwrite(){stringkey1=this.TextBox1.Text;DataSetds=newDataSet();ds.ReadXml(Server.MapPath("")+"/web.config");//不是Tables[0]ds.Tables[1].Rows[0][1]=key1;ds.A
6、cceptChanges();ds.WriteXml(Server.MapPath("")+"/web.config");ds.Dispose();} beconsistentwithinthesamedisk.Alternateunifiedcorerequirementsplacedontheterminalstripterminals,onlineidentityandensurethecoppercoreisnotexposed.6.4.6enclosurewithinthesametothecable
7、coreprovidesbindingintoacircle,harnesstiespacingisgenerally100mm;branchofficesshallbebindingonbothends,eachcore转自:http://blog.tianya.cn/blogger/post_show.asp?BlogID=284576&PostID=3517248作者:山谷银月stringServer.MapPath(stringpath)返回与Web服务器上的指定虚拟路径相对应的物理文件路径。
8、Html代码1.<%=Server.MapPath(Request.ServerVariables["PATH_INFO"])%> 2. 3.<%= Server.MapPath("/")%> 4.<%= Server.MapPath("")%> 5.<%=Server.MapPath(".")%> 6. 7.<%= Server.MapPath("../
此文档下载收益归作者所有