国产探花免费观看_亚洲丰满少妇自慰呻吟_97日韩有码在线_资源在线日韩欧美_一区二区精品毛片,辰东完美世界有声小说,欢乐颂第一季,yy玄幻小说排行榜完本

首頁 > 編程 > C# > 正文

c# 獲得當前絕對路徑的方法(超簡單)

2020-01-24 00:21:24
字體:
供稿:網(wǎng)友

廢話不多說,直接上代碼

/// <summary>    /// 獲得當前絕對路徑    /// </summary>    /// <param name="strPath">指定的路徑</param>    /// <returns>絕對路徑</returns>    public static string GetMapPath(string strPath)    {      if (strPath.ToLower().StartsWith("http://"))      {        return strPath;      }      if (HttpContext.Current != null)      {        string path = HttpContext.Current.Server.MapPath("~/" + strPath);        return path;      }      else //非web程序引用      {        strPath = strPath.Replace("/", "http://");        if (strPath.StartsWith("http://"))        {          strPath = strPath.Substring(strPath.IndexOf('//', 1)).TrimStart('//');        }        return System.IO.Path.Combine(AppDomain.CurrentDomain.BaseDirectory, strPath);      }    }

以上這篇c# 獲得當前絕對路徑的方法(超簡單)就是小編分享給大家的全部內(nèi)容了,希望能給大家一個參考,也希望大家多多支持武林網(wǎng)。

發(fā)表評論 共有條評論
用戶名: 密碼:
驗證碼: 匿名發(fā)表
主站蜘蛛池模板: 临潭县| 布尔津县| 资中县| 佛山市| 泰州市| 杨浦区| 平凉市| 吉水县| 抚松县| 阿勒泰市| 太仆寺旗| 甘肃省| 新津县| 平南县| 东源县| 那曲县| 平阴县| 微山县| 鲁甸县| 延津县| 鄯善县| 吉安市| 洪雅县| 印江| 西贡区| 行唐县| 大埔区| 雷山县| 镇远县| 卢氏县| 平和县| 辽中县| 莫力| 富顺县| 广宗县| 衡南县| 兴文县| 济源市| 仙居县| 通州市| 平阳县|