asp.net获取网站目录物理路径示例
asp.net获取网站目录物理路径示例
发布时间:2016-12-29 来源:查字典编辑
摘要:页面后台cs文件的相对网站根目录的路径/view/Atlas复制代码代码如下:stringrootPath1=Server.MapPath(...

页面后台cs文件的相对网站根目录的路径/view/Atlas

复制代码 代码如下:

string rootPath1= Server.MapPath("~");

string rootPath2 = Request.ApplicationPath;

string path1 = Server.MapPath("upload");

string path2 = Server.MapPath("");

string path3 = Server.MapPath(".");

string path4 = Server.MapPath("..");

string path5 = Server.MapPath(Request.ServerVariables["PATH_INFO"]);

结果

复制代码 代码如下:

string rootpath1= "F:ASP.NET_Projects超凡装饰cfzsWebcfzsWeb";

string rootpath2= "/Web";

string path1 = "F:ASP.NET_Projects超凡装饰cfzsWebviewAtlasuploadcfzsWebviewAtlasupload";

string path2 = "F:ASP.NET_Projects超凡装饰cfzsWebviewAtlascfzsWebviewAtlas";

string path3 = "F:ASP.NET_Projects超凡装饰cfzsWebviewAtlascfzsWebviewAtlas";

string path4 = "F:ASP.NET_Projects超凡装饰cfzsWebviewcfzsWebview";

string path5 = "F:ASP.NET_Projects超凡装饰cfzsWebviewAtlasAdd.aspxcfzsWebviewAtlasAdd.aspx";

推荐文章
猜你喜欢
附近的人在看
推荐阅读
拓展阅读
相关阅读
网友关注
最新asp.net教程学习
热门asp.net教程学习
编程开发子分类