Reputation: 55
So I have a file(e.g. index.html) and I want to get the Path of it. Most of my files are stored in the debug- folder. So e.g. I wanna get the Path :
C:\documents and settings\administrator\My Documents\Visual Studio 2010\Projects\WebServer\WebServer\bin\Debug\index.html
I already tried Path.GetDirectoryname(filename); //doesn't work because I don't get anything back
Upvotes: 2
Views: 333
Reputation: 62248
You are probably searching for Server.MapPath.
The MapPath method maps the specified relative or virtual path to the corresponding physical directory on the server.
From the name of the file and expected result I deduct that you're asking for ASP.NET
.
Upvotes: 1