Các đọc toàn bộ dữ liệu trong file text (.txt) đã được chọn từ FileUpload trong lập trình web asp.net (C#) như sau: Trong file xxx.ASPX chèn code html sau: Mã: <asp:FileUpload ID="txtFile" runat="server" Style="width: 100%" /> <asp:Button ID="btnRedFile" runat="server" Text="UpLoad" OnClick="btnRedFile_Click" /> Trong code xxx.ASPX.CS chèn code sau: Mã: protected void btnRedFile_Click(object sender, EventArgs e) //upload { try { List<string> ListRecords = new List<string>(); if (!txtFile.HasFile) { return; } using (StreamReader tempReader = new StreamReader(txtFile.FileContent)) { string tempLine = string.Empty; while ((tempLine = tempReader.ReadLine()) != null) { ListRecords.Add(tempLine); } } } catch (Exception ex) { } } Tất cả dữ liệu đều được chuyển vào Mảng ListRecords bạn chỉ cần lấy ra sử dụng thôi.