public static void SaveFile(string TxtStr, string tempDir, bool noBom) { try { DirFile.CreateDir(DirFile.GetFolderPath(true, tempDir)); StreamWriter streamWriter = !noBom ? new StreamWriter(HttpContext.Current.Server.MapPath(tempDir), false, Encoding.UTF8) : new StreamWriter(HttpContext.Current.Server.MapPath(tempDir), false, (Encoding) new UTF8Encoding(false)); streamWriter.Write(TxtStr); streamWriter.Close(); } catch (Exception ex) { throw ex; } }
public static string GetFolderPath(string filePath) { return(DirFile.GetFolderPath(false, filePath)); }