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.
- 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 basic so if you try first one. It will load
c:\users\lenovo\documents\visual studio 11\Projects\WebApplication1\WebApplication1\
It’s very easy hope you like it. Stay tuned for more.
0 comments:
Post a Comment
Your feedback is very important to me. Please provide your feedback via putting comments.