In ASP environment, MapPath method returns the physical path of the file or directory from the virtual path.
 

Here is an example

response.write(Server.MapPath("test.asp")
The output of the above line is here
C:\Inetpub\wwwroot\my_files\test.asp

Note that the object Server.MapPath does not check the existence of actual path, it only maps the given path along with the physical path.
In above case, even if "test.asp" does not exist in present script running  location, it does not show error.
 
 
To get the server root we have to use

response.write(Server.MapPath("\")
output =  C:\Inetpub\wwwroot
 
 
To get the root of the present script running we have to use like this.

response.write(Server.MapPath(".")
output = C:\Inetpub\wwwroot\my_files

0 comments: