Hello and welcome to our community! Is this your first visit?
Register
Enjoy an ad free experience by logging in. Not a member yet? Register.
Results 1 to 6 of 6
  1. #1
    New Coder
    Join Date
    Jan 2004
    Posts
    53
    Thanks
    0
    Thanked 0 Times in 0 Posts

    Question Problem writing a text file(OpenTextFile)

    Hi there, I'm having a hard time to open/write to a txt file from a .asp, the code is right, but, looks that the iis 5.0 is messing with the file system.

    once the execution gets to the point of :
    Set filetxt = filesys.OpenTextFile(sFilePathAndName, ForReading, False)

    the browser just hangs forever, If I do the request to the same .asp several times then the IIS hangs, and can not even stop the service(a bug in IIS).

    I'm running w2k pro, w/IIS 5.0

    Here is the code, any help is fully appreciated:

    <%
    Const fsoForAppend = 8

    Dim objFSO
    Set objFSO = Server.CreateObject("Scripting.FileSystemObject")

    'Open the text file
    Dim objTextStream
    Set objTextStream = objFSO.OpenTextFile("C:\Welcome.txt", fsoForAppend)

    'Display the contents of the text file
    objTextStream.WriteLine "Hello, World!"
    objTextStream.WriteLine "This is fun!!"

    'Close the file and clean up
    objTextStream.Close
    Set objTextStream = Nothing
    Set objFSO = Nothing
    %>

  • #2
    Supreme Master coder! glenngv's Avatar
    Join Date
    Jun 2002
    Location
    Philippines
    Posts
    11,042
    Thanks
    0
    Thanked 251 Times in 247 Posts
    Does the "C:\Welcome.txt" file exist?

    Try specifying true in the 3rd parameter that indicates the file should be created if it doesn't exist.

    Set objTextStream = objFSO.OpenTextFile("C:\Welcome.txt", fsoForAppend, true)

  • #3
    New to the CF scene
    Join Date
    Jul 2004
    Posts
    1
    Thanks
    0
    Thanked 0 Times in 0 Posts
    Hi.. having the same problem with IIS. Yes the file exists and permissions are set correctly. I've seen a couple of other posts around that might suggest it's an antivirus problem.

  • #4
    New Coder
    Join Date
    Jan 2004
    Posts
    53
    Thanks
    0
    Thanked 0 Times in 0 Posts

    server.mappath

    can somebody help meeeeeeeeeeeeeeeeeeeeeeee

    I deactivated the antivirus and the problem persits

  • #5
    New Coder
    Join Date
    Jan 2004
    Posts
    53
    Thanks
    0
    Thanked 0 Times in 0 Posts

    fixed

    Problem was the script blocking software.......................

  • #6


  •  

    Posting Permissions

    • You may not post new threads
    • You may not post replies
    • You may not post attachments
    • You may not edit your posts
    •