Browse DevX
Sign up for e-mail newsletters from DevX

Tip of the Day
Language: Web
Expertise: Intermediate
Nov 23, 1999



Building the Right Environment to Support AI, Machine Learning and Deep Learning

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).

<%@ Language=VBScript %>
Response.Write Request.ServerVariables("PATH_INFO") & "<BR>" 
Response.Write Request.ServerVariables("SCRIPT_NAME") & "<BR>"
Response.Write Server.MapPath(Request.ServerVariables("SCRIPT_NAME"))
for each Var in Request.ServerVariables
 Response.Write Var & ":" & Request(Var) & "<BR>"
Ken Cox
Comment and Contribute






(Maximum characters: 1200). You have 1200 characters left.



Thanks for your registration, follow us on our social networks to keep up-to-date