将两个字符串组合成一个路径

private string GenerateImageFilePath(string fileName, string fileExt = ".jpg")
  {
   string dir = Path.Combine(Server.MapPath("~/"), "Images");
   if (!Directory.Exists(dir))
   {
    Directory.CreateDirectory(dir);
   }
   string filePath = Path.Combine(dir, fileName + fileExt);
   return filePath;
  }

原文地址:https://www.cnblogs.com/DTWolf/p/4673277.html