devxlogo

Finding Your Directory in IIS for the FileSystemObject

Finding Your Directory in IIS for the FileSystemObject

The FileSystemObject object (sic) in Active Server Pages (ASP) is very handy for reading, writing, and deleting files via server-side script. However, it isn’t always easy to locate your files on your ISP’s system. The FileSystemObject object requires a physical path to the file, not a virtual directory name. Fortunately, you can calculate the exact path using ASP’s Request.ServerVariables and Server.MapMath methods. Once you determine where your virtual directory resides, you can pass the path to the FileSystemObject object’s methods.

This script shows how to use Request.ServerVariables to discover the needed information–and a lot more–from Internet Information Server (IIS).

 " Response.Write Request.ServerVariables("SCRIPT_NAME") & "
"Response.Write Server.MapPath(Request.ServerVariables("SCRIPT_NAME"))%>
"next%>
devxblackblue

About Our Editorial Process

At DevX, we’re dedicated to tech entrepreneurship. Our team closely follows industry shifts, new products, AI breakthroughs, technology trends, and funding announcements. Articles undergo thorough editing to ensure accuracy and clarity, reflecting DevX’s style and supporting entrepreneurs in the tech sphere.

See our full editorial policy.

About Our Journalist