May 12, 2021 ASP.NET
ASP.NET you can store data in a Web Pages file, as long as you need to add a text file, and you'll learn more about Web Pages files below.
This chapter describes the use of text files.
In the previous sections, we learned that web page data is stored in a database.
You can also store site data in a text file.
Text files used to store data are often referred to as flat files. Common text file formats are .txt, .xml, and .csv (comma-separated values).
In this chapter, you'll learn:
In the following example, you will need a text file.
On your site, if you don't App_Data folder, create one. In App_Data folder, create a file called Persons .txt file.
Add the following to the file:
The following example shows how to display data in a text file:
Use Server.MapPath to find the exact path to the text file.
Use File.ReadAllLines to open a text file and read all the lines in the file into an array.
The data for the data items in each data row in the array is displayed.
With Microsoft Excel, you can save a spreadsheet as a comma-separated text file .csv file. At this point, each row in the spreadsheet is saved as a line of text, and each data column is separated by a comma.
in you can use the instance above to read an Excel .csv file (just change the file name to the name of the corresponding Excel file).