Link to home
Start Free TrialLog in
Avatar of skij
skijFlag for Canada

asked on

Classic ASP: Write to file

Using Classic ASP, how can I create a file in the current directory?

This returns an error:
<%

set oFs = server.createobject("Scripting.FileSystemObject")
set oTextFile = oFs.OpenTextFile(Server.MapPath(".") & "\Test.txt", 2, True)
oTextFile.Write "Test Content"
oTextFile.Close
set oTextFile = nothing
set oFS = nothing

Response.Write("-- Done --")

%>

Open in new window

ASKER CERTIFIED SOLUTION
Avatar of Big Monty
Big Monty
Flag of United States of America image

Link to home
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
Start Free Trial
Avatar of skij

ASKER

That code returns this error:
The page cannot be displayed because an internal server error has occurred.

Open in new window

Even these two lines, with no other lines, cause the same error:
<%

set oFs = server.createobject("Scripting.FileSystemObject")
set oTextFile = oFs.CreateTextFile(Server.MapPath(".") & "\Test.txt", True)

Open in new window

How can I debug this and solve the problem?  Thanks.
in IIS, in the ASP section, under debugging, there's an option to send errors to the browser.

my guess is it's a permissions issue
SOLUTION
Link to home
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
Start Free Trial