I like how you can get the Web server paths for a file with Url.Content, is there an equivalent for local paths, for example if I would want to save a file?
Asked
Active
Viewed 1,053 times
4 Answers
3
The MapPath
method maps the specified relative or virtual path to the corresponding physical directory on the server. msdn Also look at server.mappath(“.”), server.mappath(“~”), server.mappath(@“\”), server.mappath(“/”). What is the difference?

Community
- 1
- 1

webdeveloper
- 17,174
- 3
- 48
- 47
0
The Environment.SpecialFolder
enumeration has a selection of special paths you can use, for instance, you could use something like below to get a path to the user's Application Data path:
string appDataPath =
Path.Combine(
Environment.GetFolderPath(Environment.SpecialFolder.ApplicationData),
"YourCompany\\YourApp");

Adrian Thompson Phillips
- 6,893
- 6
- 38
- 69
0
I usually accomplish this using:
Server.MapPath(Url.Content("[...]"));
Reggards

gustavodidomenico
- 4,640
- 1
- 34
- 50
0
Do you want to get physicalPath?
Then try:
string physicalPath = Server.MapPath("/bin");

Fonseca
- 111
- 4