public void writeServiceDirectory(Provider provider, List <ServiceReportItem> services) { string fileName = String.Format("ServiceDirectory_{0}_{1:MM-dd-yyyy}", provider.Name.Replace(" ", "-"), DateTime.Now); string filePath = System.Web.HttpContext.Current.Server.MapPath("~/Reports/" + fileName); DataTable dt = DataConversion.ToDataTable(services); //you can activate next line to do CSV file // ReportWriter.CreateCSVFile(dt, filePath + ".txt"); ReportWriter.CreateHtmlFile(dt, filePath + ".html"); }