Those are working on in web technologies like ASP.Net and ASP are already familiar with server.MapPath method. It is used to Maps a virtual or relative path to a physical path. Recently I had discussion with my friends what kind of options we have for Server.MapPath and We have discussed lots of things. So I thought it will be a good idea to write a blog post about it. I know this is very basic but sometimes we were not aware about basic things. So following are different kind of options we have with Server.MapPath.
It’s very easy hope you like it. Stay tuned for more.
- Server.MapPath("~") return the root physical path of application.
- Server.MapPath(“.”) returns the current physical path of a executing file(i.e .aspx file)
- Server.MapPath(“..”) returns the current physical path of parent directory of executing file.
- Server.MapPath("/") returns the he physical path to the root of the domain name
It’s very easy hope you like it. Stay tuned for more.