Reputation:
I wanted to read and parse a .txt
file by calling it in the project's folder.
this is the read code
string[] line = { };
string route = @"~\\file\\" + ".text";
line = System.IO.File.ReadAllLines(route);
the error comes when it tries to read all the lines from the file, it goes to another route that is the following:
C:\Program Files (x86)\IIS Express\~\Files\.text
and the project is located on the D drive.
Upvotes: 0
Views: 422
Reputation: 3584
string route = Server.MapPath(@"~\\file\\myfile.txt");
string[] line = System.IO.File.ReadAllLines(route);
Upvotes: 1