Click here to Skip to main content
15,886,091 members
Please Sign up or sign in to vote.
0.00/5 (No votes)
How to read the contents from .txt file or .ini file in web application.i want to read the each name from a name list in the text file.
Posted

Open the file and read it.

MIDL
using(StreamReader stream = new StreamReader("filename"))
{
    string line = null;
    while( (line = stream.ReadLine()) != null)
    {

    }
}
 
Share this answer
 
string fileText = System.IO.File.ReadAllText("filename")


But ini files are a different matter. Unless you are accessing settings in a legacy app, DON'T USE INI files, instead use your web.config file.
 
Share this answer
 
v2

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)



CodeProject, 20 Bay Street, 11th Floor Toronto, Ontario, Canada M5J 2N8 +1 (416) 849-8900