I have a .NET application that I am trying to debug, and part of my application is loading a file from my project. This file is located in
C:\Users\USER_FOLDER\Documents\Visual Studio 2012\Projects\MY_PROJECT\_templates\myFile.html
In my code, I specify the relative path to the file and use the DirectoryInfo class to get the full path to the file in my file:
string myFile = (new DirectoryInfo("_templates/myFile.html")).FullName;
However, this returns the following path (extra \ as escape characters):
"C:\\Program Files\\IIS Express\\_templates\\myFile.html"
I was expecting the path to be returned when debugging in IIS Express matches the first path I listed, not the third. Why is this? Is there anything else I need to configure in my project in order to get the correct paths? I assume that this will not happen if I deploy my code to the IIS7 site, but have not yet reached the testing level.
source share