p2p.wrox.com Forums

Need to download code?

View our list of code downloads.


  Return to Index  

proasp_codeclinic thread: server objec failed


Message #1 by philip.moh@a... on Wed, 26 Sep 2001 14:08:24 +0800
The only thing you are using is the Scripting.FileSystem object, so your
best bet is that that is not (properly) installed. Get the following
download to check which components are installed:
www.aspnl.com/aspnl/nl/downloads/compcheck.zip

It contains two files, one of which is an  .asp file. put them in the same
dir of your web and run the .asp file.

---
Michiel van Otegem
ASPNL.com    - ASP/ASP.NET/XML Teacher
ASPLists.com - Moderator

http://www.aspnl.com
http://www.aspalliance.com/michiel
off-list email: michiel@a...
---
----- Original Message -----
From: <philip.moh@a...>
To: "Code Clinic" <proasp_codeclinic@p...>
Sent: Wednesday, September 26, 2001 8:52 AM
Subject: [proasp_codeclinic] server objec failed


|
| Hi,
|
| I have the following code, when I run it I got the server.object failed.
| Why?
|
| my code:
|
| <% @ Language = VBScript %>
| <%
| Option Explicit
| Response.Buffer = True
|
|
| Function FileRead(byVal FILE)
| Dim strOut : strOut = ""
| Dim objFSO, FileDownload
| Set objFSO = server.CreateObject("scripting.filesystemobject")
|     'set FileDownload = ObjFSO.OpenTextFile(FILE, 1, False)
| strOut = FileDownload.ReadAll()
| FileDownload.Close
| Set FileDownload = Nothing
| Set objFSO = Nothing
| FileRead = strOut
| End Function
|
|
| Dim strFileToDownload, strFileContents
|
| strFileToDownload = Request.QueryString("c:\excelfiles\unknown\test.txt")
| strFileContents = FileRead( strFileToDownload )
|
|
| response.AddHeader "Content-Disposition", "filename=" & strFileToDownload
| response.ContentType = "application/octet-stream"
| response.Write strFileContents
|
| %>
|
| Please advise.

  Return to Index