www.webdeveloper.com
Results 1 to 10 of 10

Thread: write to file with fso

  1. #1
    Join Date
    Jun 2003
    Location
    Indiana, USA
    Posts
    1,138

    write to file with fso

    I was going to use XML but this file has to be secure because it will contain username and encrypted password information. That is why I would like to use the .asp extension. I have variables set in an asp file that I would like to update somehow and I'm thinking fso. I know how to create and delete files with fso but I cannot find anything pertaining to this. Any ideas?

  2. #2
    Join Date
    Jan 2004
    Location
    Melbourne, Australia
    Posts
    5,298
    You will need to search for the keyword within the file and then edit its respective value. A Regular Expression pattern will acheive this fairly easily.

    See the RegExp object.

    Regards.

  3. #3
    Join Date
    Jun 2003
    Location
    Indiana, USA
    Posts
    1,138
    Thanks. I cannot find out anything about how to update the file though.

  4. #4
    Join Date
    Jan 2004
    Location
    Melbourne, Australia
    Posts
    5,298
    Write to it in the normal way you would. The contents is overwritten by default.

    http://www.google.com.au/search?hl=e...+to+file&meta=

    Regards.

  5. #5
    Join Date
    Jun 2003
    Location
    Indiana, USA
    Posts
    1,138
    I have setup a for loop that shows all the files in a specified folder. How can I put an if statement in there that says If filename="filename I don't want to show" = true then skip?

  6. #6
    Join Date
    Jan 2004
    Location
    Melbourne, Australia
    Posts
    5,298
    Look at the properties available to you in the File object. How you actually go about doing this would be deendant on how you have written your application.
    Code:
    For i = 0 To 10
       If Not objFile.Name = "filename.ext" Then
          '| Statements...
       End If
    Next
    End If
    Regards.

  7. #7
    Join Date
    Jun 2003
    Location
    Indiana, USA
    Posts
    1,138
    I have searched the internet over and can not find any information about updating a pages contents with fso. Any ideas?

  8. #8
    Join Date
    Jan 2004
    Location
    Melbourne, Australia
    Posts
    5,298
    I do it with my calendar. The following file uses a Regular Expression to search for embedded file paths (SSI directives usually), alter them to accord to the current location of the calendar, and then saves the file.

    You should be able to use it for reference. (changed tot TXT to conform to forum file upload rules)

    Regards.
    Attached Files Attached Files

  9. #9
    Join Date
    Jun 2003
    Location
    Indiana, USA
    Posts
    1,138
    Thanks. I learn by example! Does .net do this in an easier way?

  10. #10
    Join Date
    Jan 2004
    Location
    Melbourne, Australia
    Posts
    5,298
    Probably! I have never looked into it.

Thread Information

Users Browsing this Thread

There are currently 1 users browsing this thread. (0 members and 1 guests)

Posting Permissions

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



Recent Articles