获取完整服务器上文件所处位置(包含域名)

 1         /// <summary>

 2         /// 服务器路径

 3         /// </summary>

 4         public static string ServerPath

 5         {

 6             get

 7             {

 8                 string serverPath = HttpContext.Current.Request.Url.Authority;

 9 

10                 if (serverPath == "/")

11                 {

12                     return string.Empty;

13                 }

14                 else

15                 {

16                     return serverPath;

17                 }

18             }

19         }

20 

21     /// <summary>

22     /// 加载视频

23     /// </summary>

24     [AjaxPro.AjaxMethod()]

25     public string GetVideoUrl(int id)

26     {

27         string strUrl = "http://";

28 

29         if (id > 0)

30         {

31             //获取视频文件实体对象

32             VideoModel = VideoBll.GetModel(id);

33             //获得完整视频路径,由服务器域名+文件夹名称+视频名称

34             strUrl += Globals.ServerPath + Common.ConfigHelper.upLoadVideoPath + VideoModel.ImgUrl;

35         }

36 

37         return strUrl;

38     }    

你可能感兴趣的:(服务器)