asp.net获取应用程序路径

Code Snippet
  1. public static string ApplicationPath()
  2. {
  3.     string m_Application;
  4.     if (HttpContext.Current.Request.ApplicationPath.Equals("/"))
  5.     {
  6.         m_Application = "http://" + HttpContext.Current.Request.Url.Authority;
  7.     }
  8.     else
  9.         m_Application = HttpContext.Current.Request.ApplicationPath;
  10.     return m_Application;
  11. }

可以获取网站路径和虚拟目录路径

posted @ 2009-09-30 09:56  流泉飞石  阅读(502)  评论(0编辑  收藏  举报