西沉_NET

NET技术
posts - 4, comments - 2, trackbacks - 0, articles - 0
  IT博客 :: 首页 :: 新随笔 :: 联系 :: 聚合  :: 管理

返回应用程序的绝对路径

Posted on 2005-12-12 17:48 西沉 阅读(210) 评论(0)  编辑 收藏 引用

 

 1/// <summary>
 2/// 返回应用程序的绝对路径
 3/// </summary>
 4/// <returns></returns>

 5  public static string root()
 6  {
 7   string serverpath=HttpContext.Current.Request.ServerVariables["HTTPS"];
 8   string pro=(serverpath=="on")?"https://":"http://";
 9
10   string servername=HttpContext.Current.Request.ServerVariables["Server_Name"];
11   string appname=HttpContext.Current.Request.ApplicationPath;
12
13   string path=pro+servername+appname;
14   return path;
15  }

16 }
17
只有注册用户登录后才能发表评论。