GetRootURI

   public static string GetRootURI()
    {
   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 == "/")
      AppPath = UrlAuthority;
  else
      AppPath = UrlAuthority + Req.ApplicationPath;
   }
   return AppPath;
    }

posted on 2011-11-23 15:06  lock  阅读(192)  评论(0编辑  收藏  举报