Code to Read and Display the Contents of a Server-Side File

This example uses the ReadFromFile method of the AdminFiles object to read the text file contents; the Internet Information Services (IIS) intrinsic method Response.Write is then used to write those contents to the browser. If you want to read and write file types other than text files, use the ReadFromBinaryFile method of the AdminFiles object in conjunction with the Response.WriteBinary method.

Create the example ASP page using the following code:

<HTML>
<HEAD>
</HEAD>
<BODY>
<%
Dim oAdminFiles, strRet
Set oAdminFiles = Server.CreateObject("Commerce.AdminFiles")
strRet = oAdminFiles.ReadFromFile("c:\temp\Sample.txt")
Response.Write strRet
%>
</BODY>
</HTML>

Copyright © 2005 Microsoft Corporation.
All rights reserved.