troubleshooting Question

Using XMLHTTP and preserving session variables

Avatar of tnelson217
tnelson217 asked on
18 Comments1 Solution3082 ViewsLast Modified:
I have found a few posts on this topic and have tried to follow the suggestions in the posts but have not been successful.

I am trying to use XMLHTTP to build a page.  The end result is that I want to append several pages together and then print them.  But for now I'm just trying to get it work with one page, putting the generated page text into a variable.  I'll build from there once I get this working.  However, I am having a problem with getting past my site's authentication.  I saw a few posts on this same issue, and decided to try to send the cookies on the request header.  Here is the code that I have (my actual URL chagned to protect the innocent).

I log into the application, navigate to the point at which I would be running this when it is working, then load this page (test_print_2.asp) and I get the login page instead of the page I want to build.  So it is not recognizing the session variables.  Any ideas as to what I'm doing wrong?

I will post a separate comment with a link to the EE post that sent me in this direction.

<%@ Language = VBScript %>
Response.Buffer = True
Dim objXMLHTTP, xml, myVariable

' Create an xmlhttp object:
Set objHTTP = Server.CreateObject("MSXML2.ServerXMLHTTP")

' Call the page
objHTTP.Open "GET", "http://mydomain/myapp/mypage.asp?q_type=Current", False
objHTTP.setRequestHeader ("cookie") = Request.Cookies
' Put this in twice due to MS bug
objHTTP.setRequestHeader ("cookie") = Request.Cookies

myVariable = objHTTP.responseText
Set xml = Nothing


Saved into variable.

The contents of the xml variable:  
Join the community to see this answer!
Join our exclusive community to see this answer & millions of others.
Unlock 1 Answer and 18 Comments.
Join the Community
Learn from the best

Network and collaborate with thousands of CTOs, CISOs, and IT Pros rooting for you and your success.

Andrew Hancock - VMware vExpert
See if this solution works for you by signing up for a 7 day free trial.
Unlock 1 Answer and 18 Comments.
Try for 7 days

”The time we save is the biggest benefit of E-E to our team. What could take multiple guys 2 hours or more each to find is accessed in around 15 minutes on Experts Exchange.

-Mike Kapnisakis, Warner Bros