Migrating a Web Server to IIS 5.0 |
CGI applications frequently interact with the file system. There are several approaches to accessing the file system from within the ASP environment. The easiest method is to use the FileSystemObject and TextStream objects, which provide high-level access to the file system. For example, the following ASP page, written in VBScript, creates a text file, and writes the contents of the environment variable Server_Name to its own line:
<%@ LANGUAGE=VBScript %>
<HTML>
<BODY>
<%
Dim objFS, objFile, append
append = 8
Set objFS = Server.CreateObject("Scripting.FileSystemObject")
Set objFile = objFs.OpenTextFile("c:\servlist.txt", append, True )
objFile.WriteLine Request.ServerVariables("SERVER_NAME")
objFile.Close
%>
Done
</BODY>
</HTML>
If the supplied FileSystemObject and TextStream objects do not meet your needs, file system access can be encapsulated with a COM component. To learn more about components, see the “COM Concepts” topic in the IIS 5.0 section of the SDK documentation on MSDN, and see http://www.microsoft.com/com/.