View Single Post
Old Jun 18th, 2005, 12:02 PM   #1
Intimidat0r
Hobbyist Programmer
 
Intimidat0r's Avatar
 
Join Date: May 2005
Location: Don't know, but the padded walls are a nice touch.
Posts: 126
Rep Power: 0 Intimidat0r is an unknown quantity at this point
Send a message via ICQ to Intimidat0r Send a message via AIM to Intimidat0r Send a message via MSN to Intimidat0r Send a message via Yahoo to Intimidat0r
writing files in asp

Okay, here's the problem. When I try to go to the page with the ASP code, it says

Server.MapPath() error 'ASP 0174 : 80004005'

Invalid Path Character(s)

/goldteam/confirm_write.asp, line 9

An invalid '/' or '\' was found in the Path parameter for the MapPath method.

Here's the code:
<% Option Explicit
Dim FileName
FileName = "teachers/" & Request.QueryString("teacher") & "/announcements.txt"
Const ForReading = 1, ForWriting = 2, ForAppending = 3
Const TristateUseDefault = -2, TristateTrue = -1, TristateFalse = 0
Dim FSO
Set FSO = Server.CreateObject("Scripting.FileSystemObject")
Dim FilePath
FilePath = Server.MapPath(FileName)
If FSO.FileExists(FilePath) Then
Dim File
Set File = FSO.GetFile(FilePath)
Dim Filesize
Filesize = File.size
Dim Textstream
Set Textstream = File.OpenAsTextStream(ForWriting, TristateUseDefault)
Dim Line
Dim Contents
Contents = Request.QueryString("txtAnnouncements")
TextStream.Write(Contents)
Set TextStream = Nothing
Else
Response.Redirect("file_error.asp?teacher=" & Request.QueryString("teacher"))
End If
Set FSO = Nothing
%>

in the url, it's passed a variable with the ? which i know im doing correctly. the idea is if it's pagename?teacher=bob then the file is supposed to be teachers/bob/announcements.txt which is done on line 3. does anybody know how i can fix the error?
__________________
Children in the dark cause accidents, and accidents in the dark cause children.

http://www.ronincoders.org
Intimidat0r is offline   Reply With Quote