Web Pages - Documents


  Translation results:

Web Pages

Web Pages - Documentssyntax

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 - Documentsexample

@{
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>

Popular Recommendations

Home

Videos

Q&A