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 5 of 5
  1. #1
    Regular Coder
    Join Date
    Apr 2003
    Location
    Northern California
    Posts
    169
    Thanks
    0
    Thanked 0 Times in 0 Posts

    FileSystemObject?

    Hello everyone this is my first post in asp forums hope its not too stupid! I just want to be able to access a simple text file but I cant not seem to figure it out I have used the FileSystemObject in Javascript before! Can anyone point out the error in my ways!




    <html>
    <head>
    </head>
    <body>
    <%
    Dim FSO,FILE
    FSO=Server.CreateObject("Scripting.FileSystemObject" )
    FILE=FSO.CreateTextFile("c:\test.txt",true)
    FILE.WriteLine("Some Text!" )
    FILE.Close
    FILE=nothing
    FSO=nothing
    %>
    </body>
    </html>

  • #2
    Rockstar Coder
    Join Date
    Jun 2002
    Location
    USA
    Posts
    9,074
    Thanks
    1
    Thanked 328 Times in 324 Posts

    Re: FileSystemObject?

    Originally posted by scriptkeeper

    <%
    Dim FSO,FILE
    FSO=Server.CreateObject("Scripting.FileSystemObject" )
    FILE=FSO.CreateTextFile("c:\test.txt",true)
    FILE.WriteLine("Some Text!" )
    FILE.Close
    FILE=nothing
    FSO=nothing
    %>
    The only thing I can see is that you got an extra space after the quote on the two highlighted lines. Other than that, it seems to be fine and should work; however I didn't try it.

    http://www.w3schools.com/asp/asp_ref_filesystem.asp
    http://www.w3schools.com/asp/asp_ref_textstream.asp
    Refer to these two links for examples.
    OracleGuy

  • #3
    Regular Coder
    Join Date
    Apr 2003
    Location
    Northern California
    Posts
    169
    Thanks
    0
    Thanked 0 Times in 0 Posts
    That is where I originally got it!

  • #4
    Senior Coder Morgoth's Avatar
    Join Date
    Jun 2002
    Location
    Ontario, Canada Remaining Brain Cells: 6
    Posts
    1,402
    Thanks
    2
    Thanked 1 Time in 1 Post
    2 things.

    1) You might not have admin permission to create files with your server in something like your C:\

    2) You are running Nortant Utilies, and your script blocking in ON, you might want to turn that off. That's a big issue when it comes to FSO.

  • #5
    Regular Coder
    Join Date
    Apr 2003
    Location
    Northern California
    Posts
    169
    Thanks
    0
    Thanked 0 Times in 0 Posts
    Yes I think that is it I t gives me an error now permisions denied so how would I go about setting my permisions is it part of IIS?


  •  

    Posting Permissions

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