troubleshooting Question

Using XMLHTTP and preserving session variables

Avatar of tnelson217
tnelson217 asked on
18 Comments1 Solution3083 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:  

Our community of experts have been thoroughly vetted for their expertise and industry experience.

Log in to continue reading
Become an EE member today7-DAY FREE TRIAL
Members can start a 7-Day Free trial then enjoy unlimited access to the platform for $9.99/mo
View membership options
Unlock 1 Answer and 18 Comments.
Learn why we charge membership fees
We get it - no one likes a content blocker. Take one extra minute and find out why we block content.
See how we're fighting big data
The Value of Experts Exchange in My Daily IT Life

Experts Exchange (EE) has become my company's go-to resource to get answers. I've used EE to make decisions, solve problems and even save customers. OutagesIO has been a challenging project and... Keep reading >>


Owner of Outages.IO
Phoenix, Arizona, United States
Member Since 2016
Join a full scale community that combines the best parts of other tools into one platform.
Unlock 1 Answer and 18 Comments.
View membership options
“All of life is about relationships, and EE has made a virtual community a real community. It lifts everyone's boat.”
William Peck

Member since 2004