Want to protect your cyber security and still get fast solutions? Ask a secure question today.Go Premium

x
?
Solved

Help outputting asp file results to  physical html file

Posted on 2005-04-09
8
Medium Priority
?
226 Views
Last Modified: 2012-06-21
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

%>
0
Comment
Question by:verdante
  • 4
  • 2
  • 2
8 Comments
 
LVL 15

Accepted Solution

by:
joeposter649 earned 2000 total points
ID: 13753132
You can't do that with session variables.  
There are two different sessions here...
1 between a browser and IIS that is serving the posted code.
1 between Msxml2 http://localhost/ll/doc_interview/followup_letter.asp

If followup_letter.asp is in the same IIS application you can use server.transfer or server.execute...
http://www.w3schools.com/asp/met_transfer.asp
Otherwise, pass the values in the querystring using "get"
or "post" the values...
http://msdn.microsoft.com/library/default.asp?url=/library/en-us/xmlsdk/html/xmobjXMLDOMServerXMLHTTP_using_directly.asp
0
 
LVL 29

Expert Comment

by:rdivilbiss
ID: 13767516
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
0
 
LVL 15

Expert Comment

by:joeposter649
ID: 13768937
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.
0
Concerto's Cloud Advisory Services

Want to avoid the missteps to gaining all the benefits of the cloud? Learn more about the different assessment options from our Cloud Advisory team.

 
LVL 29

Expert Comment

by:rdivilbiss
ID: 13769088
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

0
 
LVL 15

Expert Comment

by:joeposter649
ID: 13772083
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".
0
 

Author Comment

by:verdante
ID: 13811894
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

0
 
LVL 15

Expert Comment

by:joeposter649
ID: 13812299
Yes, you can inlcude a querystring in the URL.  
0
 

Author Comment

by:verdante
ID: 13812815
Thank you
Verdy
0

Featured Post

Industry Leaders: 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

By following these Magento e-commerce development tips, you can increase your website's conversion and profitability. Read this post for more details.
Why WooCommerce is one of the majorly favored choices when it comes to having an eCommerce store. This article will acquaint you with some reasons that I believe make it one of the best eCommerce platforms available.
The viewer will learn how to look for a specific file type in a local or remote server directory using PHP.
The viewer will get a basic understanding of what section 508 compliance can entail, learn about skip navigation links, alt text, transcripts, and font size controls.
Suggested Courses
Course of the Month10 days, 7 hours left to enroll

569 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