Monday, December 17, 2007

How to get the actual path of a file in the web server

How to get the actual path of a file in the web server

S T E P - 1

- We need to use Server.MapPath to get the actual path of a file in the web server.

<%

Response.write(Server.mappath("mappath.asp"))

%>

This is the output:

S T E P - 2

- We also can use use Server.MapPath to get the actual path of a folder in the web server.

<%

Response.write(Server.mappath("/asp"))

%>

S T E P - 3

- Now, we try to get the current folder that contains the ASP files.

<%

Response.write(Server.mappath("."))

%>

This is the ouput:


No comments: