Posted on: 4/4/2014 9:19:30 AM | Views : 272

Hello,
I need to get one folder up from the web apps folder. So I use:
public static string SomePath() { string path; path = HttpContext.Current.Server.MapPath(".\\"); path = Directory.GetParent(path).ToString(); path = Directory.GetParent(path).ToString(); path = path + "\\MyFolder"; return path; }
Questions:
1. Why do I need to call Directory.GetParent twice to get one level higher?
2. Why does my function return diferrent results, when called from different projects in my Solution? If I call it from a codebehind of a .aspx file it returns the folder as expected. If called from my "library" project (same Solution) it does not return "one up" folder, but the root folder of the app...
3. Is there a better way to go one ...

Go to the complete details ...