[Last Call] Learn how to a build a cloud-first strategyRegister Now

x
?
Solved

asp file system object  edit page

Posted on 2012-09-10
5
Medium Priority
?
451 Views
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
0
Comment
Question by:KeithMcElroy
  • 2
  • 2
5 Comments
 
LVL 6

Expert Comment

by:Manuel Marienne-Duchêne
ID: 38383186
Post your code
0
 

Author Comment

by:KeithMcElroy
ID: 38383208
0
 
LVL 54

Accepted Solution

by:
Scott Fell,  EE MVE earned 2000 total points
ID: 38383234
This primer may help you.  http://www.w3schools.com/asp/met_opentextfile.asp
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
	theText.WriteLine(request.form("MoreText"))
end if


%>
<form name="form1" method="post" action="">
  <textarea name="MoreText" id="MoreText" cols="45" rows="5"><%=theText%></textarea>
  <button type="submit">Save</button>
  </form>

<%
theText.Close
set theText=Nothing
set fs=Nothing
%>

Open in new window

0
 

Author Comment

by:KeithMcElroy
ID: 38383283
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?
0
 
LVL 54

Expert Comment

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

Featured Post

Technology Partners: We Want Your Opinion!

We value your feedback.

Take our survey and automatically be enter to win anyone of the following:
Yeti Cooler, Amazon eGift Card, and Movie eGift Card!

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

I was asked about the differences between classic ASP and ASP.NET, so let me put them down here, for reference: Let's make the introductions... Classic ASP was launched by Microsoft in 1998 and dynamically generate web pages upon user interact…
This demonstration started out as a follow up to some recently posted questions on the subject of logging in: http://www.experts-exchange.com/Programming/Languages/Scripting/JavaScript/Q_28634665.html and http://www.experts-exchange.com/Programming/…
Loops Section Overview
As many of you are aware about Scanpst.exe utility which is owned by Microsoft itself to repair inaccessible or damaged PST files, but the question is do you really think Scanpst.exe is capable to repair all sorts of PST related corruption issues?

834 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