public static IList <string> ReadCSVFile(HttpPostedFileBase file) { // Check if posted file is image only file.CheckCSVValidity(); IList <string> data = null; try { data = new List <string>(); using (StreamReader sr = new StreamReader(file.InputStream, Encoding.GetEncoding("iso-8859-1"))) { string line = String.Empty; while ((line = sr.ReadLine()) != null) { data.Add(line); } } } catch (IOException e) { throw new CSVValidationException("CSV file could not be read"); } return(data); }