Asp + Iis

Z

zatrix

Guest
#1
I installed me self the XP IIS. And well it works fine except that when i try to access a file using an ASP page it just freezes and the page never loads. Yes i have enabled the write, read, etc properties. Below is the code i try to use:
Code:
<%Option Explicit
' Set up Constants
Const ForWriting = 2   ' Input OutPut mode
Const Create = True    

' Dimension local variables
Dim MyFile                       
Dim FSO          ' FileSystemObject
Dim TSO          ' TextStreamObject

' always use MapPath function to get the Physical Path of file
MyFile = Server.MapPath("textfile.txt")
Set FSO = Server.CreateObject("Scripting.FileSystemObject")
Set TSO = FSO.OpenTextFile(MyFile, ForWriting, Create)
TSO.write "This is first line in this text File" & vbcrlf      
' Vbcrlf is next line character
TSO.write "This is Second line in this text file" & vbcrlf
' Now Function will write local time
TSO.write "Writen by devasp visitor at " & Now()            
TSO.WriteLine ""

Response.Write " Three lines are writen to textfile.txt <br>"
Response.Write " Local time at server is "  & Now()

' close TextStreamObject and 
' destroy local variables to relase memory
TSO.close
Set TSO = Nothing
Set FSO = Nothing
%>
And well...u guys got any ideas?
 

Khayman

I'm sorry Hal...
Political User
#2
try

cut out the line

MyFile = Server.MapPath("textfile.txt")

and just put the path of the file in the open command
ie

Set TSO = FSO.OpenTextFile("c:\whatever\textfile.txt", ForWriting, Create)

also try replaceing Set TSO = FSO.OpenTextFile(MyFile, ForWriting, Create)
with

Set TSO = FSO.OpenTextFile(c:\whatever\textfile.txt", 8, True)

do you know the line its crashing on? if not just put response.end after the first few lines then see if it freezes, if not move it a few lines and so on so you can find the exact line
 
Z

zatrix

Guest
#3
thanx i'll try that.

But i believe the problem came from:

Set TSO = FSO.OpenTextFile(MyFile, ForWriting, Create)

....
 

Members online

No members online now.

Latest posts

Latest profile posts

Perris Calderon wrote on Electronic Punk's profile.
Ep, glad to see you come back and tidy up...did want to ask a one day favor, I want to enhance my resume , was hoping you could make me administrator for a day, if so, take me right off since I won't be here to do anything, and don't know the slightest about the board, but it would be nice putting "served administrator osnn", if can do, THANKS

Been running around Quora lately, luv it there https://tinyurl.com/ycpxl
Electronic Punk wrote on Perris Calderon's profile.
All good still mate?
Hello, is there anybody in there? Just nod if you can hear me ...
Xie
What a long strange trip it's been. =)

Forum statistics

Threads
61,970
Messages
673,297
Members
89,017
Latest member
Poseeut