private static string GetTempPath(string tempFolderPath) { if (!string.IsNullOrWhiteSpace(tempFolderPath) && Directory.Exists(tempFolderPath)) { return Path.Combine(tempFolderPath, Path.GetRandomFileName()); } return Path.GetTempFileName(); }