
Accessing Data generated with client-side script from server-side script
Yes, I understand. I guess that's a bit odd since the thing to really keep
is the data, and who cares about what the page looks like, but I guess I can
understand why you'd want that, like if the confirmation page changes or
whatever. So, basically you're looking to save the response text to a file
on the server, huh?
There is no built in way of getting the response stream into a variable or
anything, like you can't do sVar = Response.Text or anything. That would be
nice... You could use the xmlhttp object to load the same page that your
user is seeing and save it that way, but if the page is the result of
method=post, that will complicate things. Probably the most reliable way to
do it would be to generate the whole page in ASP without intermixing HTML,
like so:
<%
sHTML(0) = "<html><head><title>Confirmation</title></head>"
sHTML(1) = vbCrLf & "<body>Thank you for your order. Here is your
confirmation info:"
sHTML(2) = vbCrLf & "<table width=""500"" cellpadding=""2""><tr><td>Your
name:</td><td>"
sHTML(3) = sClientName & "</td></tr>"
...etc.etc.
sResult = Join(sHTML)
Set objFSO = Server.CreateObject("Scripting.FileSystemObject")
Set objFile = objFSO.CreateTextFile("C:\SavedOrders\" & iOrderID & ".htm")
objFile.Write sResult
objFile.Close
Set objFSO = Nothing
Response.Write sREsult
%>
untested
Ray at work
Quote:
> Let me elaborate on what I'm trying to do.
> An .asp page is displaying some order information from a
> database, once the page is generated I need to keep a copy
> of that page on the server ( I only need the HTML code )
> so I can have an html page autmatically generated and
> saved for backup purposes for every PO (purchase order)
> that we process. So far I have a button that allows to
> get the HTML code from the page and display it into a
> textarea box, the problem is that to get the code you need
> to use the "document" object, e.g. document.all, which is
> accessible from client-side scripts only. I also created
> a script that saves data into a text file, but I can't get
> the HTML code from a server-side script, and I don't know
> how to get the data the I have already generated.
> Is this making any sense to you?
> Alex
> >-----Original Message-----
> >Is this a continuation of some other thread? It seems
> like it, so I don't
> >really know the context of this, but I'll tell you now
> that in a typical
> >environment, a server cannot access data on a client. If
> it could, Web
> >sites would steal your C:\My credit card numbers and web
> banking login
> >information.txt file.
> >In a private network, it's possible.
> >Ray at work
> >> But what if I don't want to resubmit the page. For
> >> example, there is some data on a form that is generated
> by
> >> a Client Side ( VBScript ) and I want my server-side
> >> Script ot get that data and save it to a file. I can
> >> generate the Data only on the client-side since it is
> >> dependent on the "document" object, and I can only save
> >> that data to a text file only with a server-side script.
> >> What Do I DO?????
> >> Thanks Alex
> >.