I'm building a webapp using ASP.NET.
On my physical hard drive:
The path for my text file is: D:\Users\(MyName)\Documents\Visual Studio 2013\Projects\(ProjectName)\(ProjectName)\Data\TextFiles\someFile.txt
The .cs file is located in: D:\Users\(MyName)\Documents\Visual Studio 2013\Projects\(ProjectName)\(ProjectName)\Account\someCSFile.cs
In my code, I have the followings:
string fileName= Server.MapPath("TextFile/someFile.txt");
The code throws an exception saying that Could not find a part of the path 'D:\Users\(MyName)\Documents\Visual Studio 2013\Projects\(ProjectName)\(ProjectName)\Account\TextFile\someCSFile.cs
How am I going to use Server.MapPath to make it "go up one level", then find the "Data" folder > "TextFiles" > finally the "someFile.txt" WITHOUT hardcoding the entire file path?