Difference between all these with example

Posted by Sahoo under ASP.NET on 6/7/2012 | Points: 10 | Views : 2640 | Status : [Member] | Replies : 1
HI,
Can anyone explain the difference between Server.MapPath("."), Server.MapPath("~"), Server.MapPath(@"\") and Server.MapPath("/")?




Responses

Posted by: Kkdubey on: 6/7/2012 [Member] Starter | Points: 25

Up
0
Down
Hi,
Server.MapPath(".") returns the current physical directory of the file (e.g. aspx) being executed
Server.MapPath("..") returns the parent directory
Server.MapPath("~") returns the physical path to the root of the application
Server.MapPath("/") returns the physical path to the root of the domain name (is not necessarily the same as the root of the application)

Regards,
Krishna

Sahoo, if this helps please login to Mark As Answer. | Alert Moderator

Login to post response