IIS and Server.MapPath

by DotNetNerd 24. June 2009 13:28

Today I experienced an issue with Server.MapPath which returned a path under inetpub/wwwroot, instead of returning the path relative to where my app was published. After a while I resolved to uncle google and found out that IIS apparently returns the path relative to the "Default Web Site" instead of relative to the actual site when the path is parallel to the sites physical path. I was kind of puzzled that I hadn't come accross this before, because it seems like something that would be a recurring issue. By noteing it here I hope to have it as a reminder for myself as well as it being a help to others, who might avoid pulling out a few hairs. 

Lately I have had a few requests to start writing in english, so as of today my posts will be written in english. I am hoping this will make my blog more usefull, and that it might result in more comments :-)

Tags:

Who am I?

My name is Christian Holm Diget, and I work as an independent consultant, in Denmark, where I write code, give advice on architecture and help with training. On the side I get to do a bit of speaking and help with miscellaneous community events.

Some of my primary focus areas are code quality, programming languages and using new technologies to provide value.

Microsoft Certified Professional Developer

Microsoft Most Valuable Professional

Month List

bedava tv izle