Frequently Asked Questions

What is the absolute or direct path for my Windows (ASP) hosting account?

Last Updated: August 3, 2007 12:22 PM

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, the root directory of a hosting account never has write access using an ASP/ASP.NET script. If you want to specify write access to a subfolder, you must define write access to that folder through the Directory Management option in your hosting account settings. You can also use he Directory Management settings to set up a "Virtual Root" in IIS by selecting the Set Root option.

The following is an example of an ASP server path:

<%
Dim thepath
thepath = Server.MapPath("")
response.write thepath
%>

Depending on your input, various outputs can occur. The following list provides examples of the output one might expect with various input:
(from script http://example.com/subdir/testmap.asp)

  • Server.MapPath("."): d:\hosting\exampleuser\subdir
  • Server.MapPath(".."): d:\hosting\exampleuser

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.