asp file system object  edit page

Posted on 2012-09-10
Last Modified: 2012-09-10
I am attempting to make a simple asp page to maintain the content of a text file, running into the following problems:

1.  The Request variable that I am using as a flag is not working
2.  How do i make the file system object edit the content with the textarea content.

Any help appreciated
Question by:KeithMcElroy
    LVL 6

    Expert Comment

    Post your code

    Author Comment

    LVL 52

    Accepted Solution

    This primer may help you.
    Notice one of the choices when opening the file is to Append (8) or Overwrite(2).  

    In this sample below, we are opening the file, bringing to the form, then saving it if the form is submitted.

    dim fs,theText
    set fs=Server.CreateObject("Scripting.FileSystemObject")
    set theText=fs.OpenTextFile(Server.MapPath("testread.txt"),2,true)
    if request.form("MoreText")<>"" then
    end if
    <form name="form1" method="post" action="">
      <textarea name="MoreText" id="MoreText" cols="45" rows="5"><%=theText%></textarea>
      <button type="submit">Save</button>
    set theText=Nothing
    set fs=Nothing

    Open in new window


    Author Comment

    Exactly what I need.  Will reward points. Just quick question.
    I am getting permission denied error.  This is a controlled citrix deal, there are no
    options to change security of the file.

    Any tips on overcoming without me having to go to the sys admin?
    LVL 52

    Expert Comment

    by:Scott Fell, EE MVE
    You have to give read write permissions to the folder the file is in.  The same is true if you use an access database.

    Write Comment

    Please enter a first name

    Please enter a last name

    We will never share this with anyone.

    Featured Post

    Enabling OSINT in Activity Based Intelligence

    Activity based intelligence (ABI) requires access to all available sources of data. Recorded Future allows analysts to observe structured data on the open, deep, and dark web.

    I recently decide that I needed a way to make my pages scream on the net.   While searching around how I can accomplish this I stumbled across a great article that stated "minimize the server requests." I got to thinking, hey, I use more than one…
    This demonstration started out as a follow up to some recently posted questions on the subject of logging in: and…
    It is a freely distributed piece of software for such tasks as photo retouching, image composition and image authoring. It works on many operating systems, in many languages.
    In this sixth video of the Xpdf series, we discuss and demonstrate the PDFtoPNG utility, which converts a multi-page PDF file to separate color, grayscale, or monochrome PNG files, creating one PNG file for each page in the PDF. It does this via a c…

    760 members asked questions and received personalized solutions in the past 7 days.

    Join the community of 500,000 technology professionals and ask your questions.

    Join & Ask a Question

    Need Help in Real-Time?

    Connect with top rated Experts

    10 Experts available now in Live!

    Get 1:1 Help Now