閱讀528 返回首頁    go 阿裏雲 go 技術社區[雲棲]


C# 將數據寫入當前程序安裝目錄某文件夾下


public static string GetXmlFullPath(string strPath)
{
    string filePath = GetPhysicalPath();
    if (filePath.IndexOf(":") > 0)
    {
        return filePath;
    }
    else
    {
        return null;
    }
}
//獲取配置文件的物理路徑
public static string GetPhysicalPath()
{
    //獲得當前程序運行的物理路徑比如F:\XFU.NSQS\project\Application\
    string filePath = HttpContext.Current.Request.PhysicalApplicationPath;
    int n = filePath.IndexOf("獲取程序安裝文件夾下某個文件名AA"); ;
    filePath = filePath.Substring(0,n) + "獲取程序安裝文件夾下某個文件名AA" + "\\文件夾AA下的某個xml文件(用來存儲相關信息)";
    return filePath;
}


最後更新:2017-04-03 12:54:19

  上一篇:go Xml SelectNodes 與 XPath
  下一篇:go 會計劄記