您的位置:首页 > 编程语言 > ASP

asp.net(c#)文件的路径表示方法

2009-04-20 13:30 441 查看
/*********************************************************************************
** IIS homedirctory在c:\inetpub\wwwroot **
** 虚拟目录在E:\WebApplication10. **
** 目前的程序在E:\WebApplication10\tmp文件夹下的一个页面. **
转自:http://www.cnblogs.com/Elong/archive/2005/06/20/177771.html
*********************************************************************************/
string str = Server.MapPath("~/languages.xml");
//str=E:\WebApplication10\languages.xml

string str1 = Server.MapPath("./languages.xml");
//str1=E:\WebApplication10\tmp\languages.xml

string str2 = Server.MapPath("../languages.xml");
//str2=E:\WebApplication10\languages.xml

string str3 = Server.MapPath("mm/languages.xml");
//str3=E:\WebApplication10\tmp\mm\languages.xml

string str4 = Server.MapPath("/mm/languages.xml");
//str4=c:\inetpub\wwwroot\mm\languages.xml
内容来自用户分享和网络整理,不保证内容的准确性,如有侵权内容,可联系管理员处理 点击这里给我发消息
标签: