Link to home
Start Free TrialLog in
Avatar of verdante
verdante

asked on

Help outputting asp file results to physical html file

I'm using the following code I obtained from another EE solution but it is not doing what I need. The asp file I'mtrying to output uses two session variables in a select statement that drives its results. I know the session variables are not null but obviously this technique ignores them. Can anyone suggest a way for me to output the results where the session variables are identified , OR I pass a querystring, OR the code is resident in the actual file I am trying to output?
ta
Verdy


<%@LANGUAGE="VBSCRIPT" CODEPAGE="1252"%>
<%
     Const ForWriting = 2
     Const ForReading = 1
     Const OVERWRITE = True
     
     DIM objFSO
     DIM objTextStream
     Dim objSvrHTTP
     Dim strHTML

session("PID") = 203
session("NEXTREVIEW") = 4
     
'     Set objSvrHTTP = Server.CreateObject("Msxml2.Server.XMLHTTP.4.0")
     Set objSvrHTTP = Server.CreateObject("Msxml2.ServerXMLHTTP")
     objSvrHTTP.open "GET", "http://localhost/ll/doc_interview/followup_letter.asp", false

'    objSvrHTTP.open "GET", "http://www.yoursite.com/yourfile.asp", false
      
     objSvrHTTP.send

     strHTML = objSvrHTTP.responseText
     strFileName = "Letter.htm"

     '--- NOW USE FILE SYSTEM OBJECT TO SAVE TO FILE ----
     
     Set objFSO = CreateObject("Scripting.FileSystemObject")
     
     '--- OPEN TEXTSTREAM OBJ FOR WRITING, OVERWRITE EXISTING FILE (IF ANY) ---
     
     Set objTextStream = objFSO.OpenTextFile(Server.MapPath(strFileName), _
                                   ForWriting, OVERWRITE)
     
     '--- WRITE STRING TO FILE ---
     objTextStream.Write strHTML
     
     '--- CLOSE AND RELEASE OBJECTS ---
     objTextStream.Close
     set objTextStream = nothing
     set objFSO = nothing

%>
ASKER CERTIFIED SOLUTION
Avatar of joeposter649
joeposter649

Link to home
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
Start Free Trial
I'm not sure you can say he can't do that give he isn't doing *anything* with the sesion variables given the code he posted.

e.g. they are not used anywhere for any purpose per what he posted.

verdante,

Can you clarify where the session variables are to be used?  As your code exists above you are not doing anything with them.

Regards,
Rod
Avatar of joeposter649
joeposter649

They said "The asp file I'mtrying to output uses two session variables in a select statement that drives its results".  I think it's safe to assume they're talking about  "http://localhost/ll/doc_interview/followup_letter.asp" using the session variables that are being set in the code posted.
You are welcome to assume.  However if the Seeion variables are not being used the way you think, the information provided may not solve the problem.

What if it was meant to be used like this?

http://localhost/ll/doc_interview/followup_letter.asp?pid=203&nextrevie=4

Regards,
Rod

I see what you're saying but you always have to start with some assumptions.

>>the information provided may not solve the problem.<<
Happens far too often! :)

>>What if it was meant to be used like this?<<
One of my solutions was to pass the values in the querystring using "get".
Avatar of verdante

ASKER

Thanks for the conversation over session variables. joep made judicious and correct assumptions. However I can also see why rd saw something strange with the code which unfortunately had some session variable clutter leftover from testing. So based on the assumptions can you please confirm that (objSvrHTTP.open "GET") allows me to pass a querystring in the URL. If the answer is 'yes' that solves my problem.

ta
Verdy

Yes, you can inlcude a querystring in the URL.  
Thank you
Verdy