Edit page content (html...to...asp)

Mike Eghtebas
Mike Eghtebas used Ask the Experts™
I want to have:

- links.asp (displays info from data.xml)
- edit.asp (to edit data.xml)
- data.xml

links.asp has some div tags, ul tags (each with a few li). This page gets some ul and li tags texts from data.xml to displays.

If this is practical, could you please give me a simple ul with few items in data.xml to be displayed on links.asp. Also edit.asp to edit data.xml content via a few text boxes on it.

If this is not practical, then what is a better approach? Could use vs 2010.

Thank you.
Watch Question

Do more with

Expert Office
EXPERT OFFICE® is a registered trademark of EXPERTS EXCHANGE®
Developer & EE Moderator
Fellow 2018
Most Valuable Expert 2013
I would start with data.asp that was delimited.  In this case, you can use the CR LF. Your data.asp page would

Open in new window

The edit.asp would use file systemobject to read the text file http://www.4guysfromrolla.com/webtech/faq/FileSystemObject/faq2.shtml and http://www.4guysfromrolla.com/webtech/faq/FileSystemObject/faq3.shtm

Please note, this code is for sample only. I have not tested it and you should always scrub your data before writing and I have not done that here.  
Dim objFSO
Set objFSO = Server.CreateObject("Scripting.FileSystemObject")
const strFileName = "D:\webroot\data.asp"
Dim objTextStream

'-------------------- for writing to the file --------------------------------
if request.form("links")<>"" then

Set objTextStream = objFSO.OpenTextFile("C:\SomeFile.txt", fsoForWriting, True)

'Display the contents of the text file
objTextStream.WriteLine request.form("links")

'Close the file and clean up
Set objTextStream = Nothing
end if

'************* For displaying in text area *****************

const fsoForReading = 1

If objFSO.FileExists("D:\webroot\data.asp") then
	'The file exists, so open it and output its contents
	Set objTextStream = objFSO.OpenTextFile(strFileName, fsoForReading)
	Response.Write "<textarea name=""links"">" & objTextStream.ReadAll & "</textarea>"
	Set objTextStream = Nothing
	'The file did not exist
	Response.Write strFileName & " was not found."
End If

'Clean up
Set objFSO = Nothing

Open in new window

And you can see how you in your links.asp you can use fso to write the data just as I have done in the textarea. I do think it would be easier to use a database though.
Mike EghtebasDatabase and Application Developer


Thank you.

Do more with

Expert Office
Submit tech questions to Ask the Experts™ at any time to receive solutions, advice, and new ideas from leading industry professionals.

Start 7-Day Free Trial