473,750 Members | 2,541 Online
Bytes | Software Development & Data Engineering Community
+ Post

Home Posts Topics Members FAQ

Textbox editing...

I know how to read a file system object and output it to the browser page.
The desired result would be to put that file into a textbox on the screen
for a user to modify and then write the file back to the file system. The
concept seems simple enough, read the text file into a variable then some
magic asp will put it into a textbox value, then somehow take that value and
write the file. I know how to write files to the system as well. I am
missing a key piece.. any ideas?

Thanks,
Ketta
Jul 19 '05 #1
6 2252
Alright, you have the file in a textbox already, so once the user submits
the file, take the request.form("t hatTextbox"), create an FSO object, and
overwrite the existing file with the contents from that textbox.

Ray at home

"Ketta" <no@post.net> wrote in message
news:%2******** ********@TK2MSF TNGP11.phx.gbl. ..
I know how to read a file system object and output it to the browser page.
The desired result would be to put that file into a textbox on the screen
for a user to modify and then write the file back to the file system. The
concept seems simple enough, read the text file into a variable then some
magic asp will put it into a textbox value, then somehow take that value and write the file. I know how to write files to the system as well. I am
missing a key piece.. any ideas?

Thanks,
Ketta

Jul 19 '05 #2
Well thanks for that part, that will definately help me. But I still do not
have the file in a textbox. It just outputs it to the screen. This is my
code for reading the file and putting it on the screen. I'm a total noob
with ASP btw. This is probably just annoying to have someone like me asking
for help. Now all I need is the code below to output to a textbox....
somehow.
<%
set fso = server.createob ject("Scripting .FileSystemObje ct")
set fs = fso.openTextFil e("textfile.txt ",1,true)
response.write replace(replace (fs.readall,"<" ,"<"),vbCrLf,"< br>")
fs.close: set fs = nothing: set fso = nothing
%>

Thank you
Ketta

"Ray at <%=sLocation% >" <myfirstname at lane 34 . komm> wrote in message
news:eZ******** ******@TK2MSFTN GP09.phx.gbl...
Alright, you have the file in a textbox already, so once the user submits
the file, take the request.form("t hatTextbox"), create an FSO object, and
overwrite the existing file with the contents from that textbox.

Ray at home

"Ketta" <no@post.net> wrote in message
news:%2******** ********@TK2MSF TNGP11.phx.gbl. ..
I know how to read a file system object and output it to the browser page. The desired result would be to put that file into a textbox on the screen for a user to modify and then write the file back to the file system. The concept seems simple enough, read the text file into a variable then some magic asp will put it into a textbox value, then somehow take that value

and
write the file. I know how to write files to the system as well. I am
missing a key piece.. any ideas?

Thanks,
Ketta


Jul 19 '05 #3

"Ketta" <no@post.net> wrote in message
news:OH******** *****@tk2msftng p13.phx.gbl...
Well thanks for that part, that will definately help me. But I still do not have the file in a textbox. It just outputs it to the screen. This is my
code for reading the file and putting it on the screen. I'm a total noob
with ASP btw. This is probably just annoying to have someone like me asking for help.
If I were annoyed, I wouldn't use newsgroups. :]
Now all I need is the code below to output to a textbox....
somehow.
<%
set fso = server.createob ject("Scripting .FileSystemObje ct")
set fs = fso.openTextFil e("textfile.txt ",1,true)
response.write replace(replace (fs.readall,"<" ,"<"),vbCrLf,"< br>")
fs.close: set fs = nothing: set fso = nothing
%>


You can just server.execute the contents of the file, i.e.

http://yoursite/filemod.asp?filename=file.txt :
<%
sFilename = Request.Queryst ring("filename" )
%>

<html>
<form method="post" action="filemod p.asp">
<input name="filename" value="<%=sFile name%>" type="hidden">
<textarea name="fileConte nts" style="width: 500px; height: 800px;"><%
Server.Execute sFilename %></textarea>
<input type="submit">
</form>

http://yoursite/filemodp.asp :
<%
Dim sFilename, sContents
sFilename = Request.Form("f ilename")
sContents = Request.Form("f ileContents")
If sFilename <> "" Then
Set oFSO = Server.CreateOb ject("Scripting .FileSystemObje ct")
Set oFile = oFSO.CreateText File(Server.Map Path(sFilename) , True)
oFile.Write sContents
oFile.Close
Set oFile = Nothing
Set oFSO = Nothing
End If

Response.Redire ct "filemod.asp?fi lename=" & sFilename
%>
Play around with that to see what I mean. But, what you'll want to do first
is create a file named "file.txt" throw a few characters into it, and then
load up the filemod.asp page with the ?filename=file. txt querystring. This
sample has no handling of errors for empty or non-existant files.

Ray at work

Jul 19 '05 #4
"Ketta" <no@post.net> wrote in message
news:OH******** *****@tk2msftng p13.phx.gbl...
Well thanks for that part, that will definately help me. But I still do not have the file in a textbox. It just outputs it to the screen. This is my code for reading the file and putting it on the screen. I'm a total noob with ASP btw. This is probably just annoying to have someone like me asking for help. Now all I need is the code below to output to a textbox....
somehow.


Wrap the file content in textarea tags like so:

<%
set fso = server.createob ject("Scripting .FileSystemObje ct")
set fs = fso.openTextFil e("textfile.txt ",1,true)
Response.Write "<textarea name='myTextAre a' cols='80' rows='10'>"
Response.Write fs.readall
Response.Write "</textarea>"
fs.close: set fs = nothing: set fso = nothing
%>

HTH
-Chris Hohmann

P.S. Your question was not annoying and you don't need to apologize for
being new to ASP. Everyone was once. :) Hope to hear from you again.
Jul 19 '05 #5
"Ray at <%=sLocation% >" <myfirstname at lane34 dot com> wrote in message
news:O$******** ******@tk2msftn gp13.phx.gbl...
You can just server.execute the contents of the file, i.e.

http://yoursite/filemod.asp?filename=file.txt :
<%
sFilename = Request.Queryst ring("filename" )
%>

<html>
<form method="post" action="filemod p.asp">
<input name="filename" value="<%=sFile name%>" type="hidden">
<textarea name="fileConte nts" style="width: 500px; height: 800px;"><%
Server.Execute sFilename %></textarea>
<input type="submit">
</form>


This introduces a significant security hole in the system since it
allows the end user to post/execute code of their choosing. I would
stick with using the FSO.

-Chris Hohmann
Jul 19 '05 #6
That is quite true.

Ray at work

"Chris Hohmann" <no****@thankyo u.com> wrote in message
news:%2******** ********@TK2MSF TNGP10.phx.gbl. ..
"Ray at <%=sLocation% >" <myfirstname at lane34 dot com> wrote in message
news:O$******** ******@tk2msftn gp13.phx.gbl...
You can just server.execute the contents of the file, i.e.

http://yoursite/filemod.asp?filename=file.txt :
<%
sFilename = Request.Queryst ring("filename" )
%>

<html>
<form method="post" action="filemod p.asp">
<input name="filename" value="<%=sFile name%>" type="hidden">
<textarea name="fileConte nts" style="width: 500px; height: 800px;"><%
Server.Execute sFilename %></textarea>
<input type="submit">
</form>


This introduces a significant security hole in the system since it
allows the end user to post/execute code of their choosing. I would
stick with using the FSO.

-Chris Hohmann

Jul 19 '05 #7

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

1
15751
by: Amadelle | last post by:
Hi all and thanks in advance for your help, I have a problem with capturing the changed value of a text box in a datagrid. The datagrid is populated based on a dataset and I am using template columns to show some of the columns. Few of the columns have textboxes to make them available for editing. I am trying to update the dataset all at once using one update button. Here is my code... (for simplicity I have only listed one of the...
2
2517
by: Martin Hazell | last post by:
For various reasons, I have had to produce a quick (!) page to edit one column of data in a database with ASP.net. With this being my first foray into ASP.net, I apoligise for any basic erros I have made. The main problem is when setting up an ASP.net datagrid, which I can edit the single value of a specific column. I have wired up the update and edit methods to change the current edit row. I worked through the example in the MSDN help to...
4
2202
by: Jason Cowsill | last post by:
Hi - I am looking for a way to dynamically alter a textbox WHILE the user is typing in it. One example would be while a user is entering their phone number a dash would be entered automatically as soon as the user types the third digit - the fourth digit would then follow the dash. I've seen this done on several sites now. I know it can be done once the user leaves the textbox with a postback, but I would like to try to accomplish it...
1
1870
by: Amadelle | last post by:
Hi all and thanks in advance for your help, I have a problem with capturing the changed value of a text box in a datagrid. The datagrid is populated based on a dataset and I am using template columns to show some of the columns. Few of the columns have textboxes to make them available for editing. I am trying to update the dataset all at once using one update button. Here is my code... (for simplicity I have only listed one of the...
7
3456
by: Cemal Karademir | last post by:
Hello, Please forgive my simple question, but i don't know the correct synatx. From the masterpage i want to put a text in an textbox and then select an item in the datagrid. I do know how to pass the items in the datagrid(e.g. PLU, description, etc.) to an other (detail)page, but i don't know the correct syntax of how to pass the textbox value to the detailpage. I have the following code:
2
5516
by: donnet | last post by:
Inside my .aspx file, I have a textbox populated with data from a dataset like this: <asp:TextBox text='<%# DataBinder.Eval(Container.DataItem, "Comment")%>' id="CommentText" runat="server" TextMode="MultiLine"></asp:TextBox> </ItemTemplate> </asp:datalist> <asp:button id="EditCommentButton" Text="Edit Comment" Runat="server"></asp:button
2
1698
by: H. Blijlevens | last post by:
Hi y'all! I'm trying to adapt a VB.Net application that a former employee built to keep track of product issues that our customers report. While doing so, I bump into the following problem: a textbox contained in a user control that's put on a MDI Child form causes the application to hang as soon as you hit the Delete key while editing. Everything freezes and only Ctrl + Esc or Ctrl + Alt + Delete will bring things back to life.
0
2008
by: Silver Oak | last post by:
I have a DataGrid in which one of the columns is TemplateColumn that was created dynamically using iTemplate. I would like to have multi-row editing capability on the DataGrid. I'm trying to follow the example in MSDN http://msdn.microsoft.com/library/default.asp?url=/library/en-us/dv_vstechart/html/vbtchTopQuestionsAboutASPNETDataGridServerControl.asp Section "Editing Multiple Rows at once". I would like to follow the second solution...
2
1824
by: zacks | last post by:
I am developing an app in VS2005 (actually in VB.NET but this question, I believe, would apply to any .NET language) that is used to design the contents of an XML file. One of potential items that would be in this XML file is a String property that contains the code for a VBScript. I have a separate form just for editing this script that uses a single Textbox. This Textbox has the AcceptsReturn, AcceptsTab and Multiline properties all set...
4
5573
by: Finn Stampe Mikkelsen | last post by:
Hi Is there any way to make the textbox property show html, like a textarea on a webpage would?? I have a webapplication that saves an textarea complete with html tags and everything... Now i'm coding a windows application to work with the same data and i need these data to be displayed on an windows form, like they would on the
0
9583
Oralloy
by: Oralloy | last post by:
Hello folks, I am unable to find appropriate documentation on the type promotion of bit-fields when using the generalised comparison operator "<=>". The problem is that using the GNU compilers, it seems that the internal comparison operator "<=>" tries to promote arguments from unsigned to signed. This is as boiled down as I can make it. Here is my compilation command: g++-12 -std=c++20 -Wnarrowing bit_field.cpp Here is the code in...
1
9342
by: Hystou | last post by:
Overview: Windows 11 and 10 have less user interface control over operating system update behaviour than previous versions of Windows. In Windows 11 and 10, there is no way to turn off the Windows Update option using the Control Panel or Settings app; it automatically checks for updates and installs any it finds, whether you like it or not. For most users, this new feature is actually very convenient. If you want to control the update process,...
0
9256
tracyyun
by: tracyyun | last post by:
Dear forum friends, With the development of smart home technology, a variety of wireless communication protocols have appeared on the market, such as Zigbee, Z-Wave, Wi-Fi, Bluetooth, etc. Each protocol has its own unique characteristics and advantages, but as a user who is planning to build a smart home system, I am a bit confused by the choice of these technologies. I'm particularly interested in Zigbee because I've heard it does some...
0
8263
agi2029
by: agi2029 | last post by:
Let's talk about the concept of autonomous AI software engineers and no-code agents. These AIs are designed to manage the entire lifecycle of a software development project—planning, coding, testing, and deployment—without human intervention. Imagine an AI that can take a project description, break it down, write the code, debug it, and then launch it, all on its own.... Now, this would greatly impact the work of software developers. The idea...
1
6808
isladogs
by: isladogs | last post by:
The next Access Europe User Group meeting will be on Wednesday 1 May 2024 starting at 18:00 UK time (6PM UTC+1) and finishing by 19:30 (7.30PM). In this session, we are pleased to welcome a new presenter, Adolph Dupré who will be discussing some powerful techniques for using class modules. He will explain when you may want to use classes instead of User Defined Types (UDT). For example, to manage the data in unbound forms. Adolph will...
0
6081
by: conductexam | last post by:
I have .net C# application in which I am extracting data from word file and save it in database particularly. To store word all data as it is I am converting the whole word file firstly in HTML and then checking html paragraph one by one. At the time of converting from word file to html my equations which are in the word document file was convert into image. Globals.ThisAddIn.Application.ActiveDocument.Select();...
0
4716
by: TSSRALBI | last post by:
Hello I'm a network technician in training and I need your help. I am currently learning how to create and manage the different types of VPNs and I have a question about LAN-to-LAN VPNs. The last exercise I practiced was to create a LAN-to-LAN VPN between two Pfsense firewalls, by using IPSEC protocols. I succeeded, with both firewalls in the same network. But I'm wondering if it's possible to do the same thing, with 2 Pfsense firewalls...
2
2807
muto222
by: muto222 | last post by:
How can i add a mobile payment intergratation into php mysql website.
3
2226
bsmnconsultancy
by: bsmnconsultancy | last post by:
In today's digital era, a well-designed website is crucial for businesses looking to succeed. Whether you're a small business owner or a large corporation in Toronto, having a strong online presence can significantly impact your brand's success. BSMN Consultancy, a leader in Website Development in Toronto offers valuable insights into creating effective websites that not only look great but also perform exceptionally well. In this comprehensive...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.