获取网站根目录C#
2014-02-10 16:27
295 查看
public static string GetWebRootPath() { string AppPath = ""; HttpContext HttpCurrent = HttpContext.Current; HttpRequest Req; if (HttpCurrent != null) { Req = HttpCurrent.Request; string UrlAuthority = Req.Url.GetLeftPart(UriPartial.Authority); if (Req.ApplicationPath == null || Req.ApplicationPath == "/") //直接安装在 Web 站点 AppPath = UrlAuthority; else //安装在虚拟子目录下 AppPath = UrlAuthority + Req.ApplicationPath; } return AppPath; }
相关文章推荐
- C# 获取网站地址或网站虚拟目录
- asp.net 获取网站根目录
- asp.net 获取网站根目录总结
- C# 1、对话框 2、文件路径 3、获取程序根目录
- 获取指定网站所有连接工具[c# winForm]
- C#获取当前user的documents目录
- js获取网站根目录
- C# 轻松获取路径中文件名、目录、扩展名等
- (转)js获取网站根路径(站点及虚拟目录)
- 获取网站的根目录的物理文件系统路径
- js获取网站根目录
- C#获取文件物理相对绝对路径目录的N种方法
- C#获取文件(磁盘驱动器)的关联图标、获取目录文件和图标
- ASP.NET编程获取网站根目录方法小结
- c# 获取当前程序运行根目录
- c# 获取项目的根目录
- php --- dirname(__FILE__) 获取网站所在目录全路径
- C# 获取IIS站点及虚拟目录信息
- 获取网站根目录contPath
- C#FTP操作类含下载上传删除获取目录文件及子目录列表等等