I'm trying to read some text from file
public void loadFromFile(string adress)
{
//int preventReadingEntireFile = 0;
try
{
using (StreamReader sr = new StreamReader(adress))
{
//preventReadingEntireFile++;
String line = sr.ReadToEnd();
Console.WriteLine(preventReadingEntireFile + ": " + line);
/*
* TODO: dodawanie słów do bazy
*/
}
}
catch (Exception e)
{
Console.WriteLine("The file could not be read:");
Console.WriteLine(e.Message);
}
}
But I don't know how to access this file (what the path is). I placed it in one of folers in my solution in my project. When I use "/TxtFiles/odm.txt" it searches for this file in "C:\TxtFiles\odm.txt" (which is wrong, there aren't any files like that there).
Is it possible? Do I have to make this file somehow "visible" for my scripts?
This is ASP.net mvc 5 project.