What is the absolute or direct path for my Windows (ASP) hosting account?
Within ASP/ASP.NET, you can use the function Server.MapPath
to return the full path to your hosting account. If you create a directory called "subdir," you could return the path to "'subdir" using Server.MapPath("subdir")
.
NOTE: Keep in mind that with ASP hosting, by default an ASP/ASP.NET script does not have write access to the root directory or subdirectories of a hosting account. If you want to specify write access to the root directory or a subdirectory, you must define write access to that directory through the File Manager option in your hosting account settings. You can also use the IIS Settings to set up a "Virtual Root" in IIS by selecting the Set Application Root option.
The following ASP server path example returns the current directory:
Dim currentdirectorypath
currentdirectorypath = Server.MapPath(".")
response.write currentdirectorypath
%>
The data returned depends on the parameter you pass to the function and your directory structure. The following examples return the parent directory path, the application's root directory, and the path to a specific page:
- Server.MapPath("..")
- Server.MapPath("/")
- Server.MapPath("myPage.aspx")
NOTE: If you are using ColdFusion scripts that require the Absolute or Direct Path, the ExpandPath() function allows you to obtain this information. You can find a description of this function and sample code on the ExpandPath page available from the Adobe Cold Fusion Functions page.