Web Pages

Web Pages - Documents syntax

You can also store site data in text files.

Text files used to store data are often called flat files. Common text file formats are .txt, .xml, and .csv (comma-separated values).

Web Pages - Documents example

@{
var dataFile = Server.MapPath("~/App_Data/Persons.txt");
Array userData = File.ReadAllLines(dataFile);
}
<!DOCTYPE html>
<html>
<body>
<h1>Reading Data from a File</h1>
@foreach (string dataLine in userData) 
{
foreach (string dataItem in dataLine.Split(',')) 
{@dataItem <text>&nbsp;</text>}
<br />
}
</body>
</html>