ServerXMLHTTP, session and cookies

M

mizi

I try to use ServerXMLHTTP object to get the session infomation from a
remote webpage, but it always returns nothing.

the follwoing is my code:

*local.asp*
url = "http://domain/remote.asp"
set xmlhttp = Server.CreateObject("MSXML2.ServerXMLHTTP")
xmlhttp.open "GET", url, false
xmlhttp.send ""
Response.write xmlhttp.responseText
set xmlhttp = nothing

*remote.asp*
bLogin = Session("login")
sUserName = Request.Cookies("username")
Response.Write(nUserID & " " & sUserName)

although the session and cookie are not blank, but I cannot received any
info. please help me, thanks a lot.
 
E

Evertjan.

mizi wrote on 05 jul 2006 in microsoft.public.inetserver.asp.general:
I try to use ServerXMLHTTP object to get the session infomation from a
remote webpage, but it always returns nothing.

the follwoing is my code:

*local.asp*
url = "http://domain/remote.asp"
set xmlhttp = Server.CreateObject("MSXML2.ServerXMLHTTP")
xmlhttp.open "GET", url, false
xmlhttp.send ""
Response.write xmlhttp.responseText
set xmlhttp = nothing

*remote.asp*
bLogin = Session("login")
sUserName = Request.Cookies("username")
Response.Write(nUserID & " " & sUserName)

although the session and cookie are not blank, but I cannot received any
info. please help me, thanks a lot.

How can the remote page be in session, if it is on a different server as
the local.asp page, as a second session cookie and username cookie can not
be set then for the right domain?
 
E

Evertjan.

Evertjan. wrote on 05 jul 2006 in
microsoft.public.inetserver.asp.general:
mizi wrote on 05 jul 2006 in microsoft.public.inetserver.asp.general:


How can the remote page be in session, if it is on a different server
as the local.asp page, as a second session cookie and username cookie
can not be set then for the right domain?

On second thought, those cookies would have to exist on the server!

That will not do.
 
M

mizi

Hi,

thanks for your reply. The two asp pages are on different servers. what I
try to do is automatic login. eg., user A has logged in at Server A. some
links on web pages of server A point to server B. so when server B detected
a visitor is coming from server A, it will check if the user has logged in
Server A. if logged in, then set the user also logged in Server B.

What I thought before is remote.asp is executed on Server B, so it can
retrive session and cookies through it. but the fact has proved I'm wrong.
I'm wondring is it possible to retrieve sessions and cookies of a remote
server?

thanks.
 
E

Evertjan.

mizi wrote on 05 jul 2006 in microsoft.public.inetserver.asp.general:

Please quote on usenet, this is not email.

thanks for your reply. The two asp pages are on different servers.
what I try to do is automatic login. eg., user A has logged in at
Server A. some links on web pages of server A point to server B. so
when server B detected a visitor is coming from server A, it will
check if the user has logged in Server A. if logged in, then set the
user also logged in Server B.

What I thought before is remote.asp is executed on Server B, so it can
retrive session and cookies through it. but the fact has proved I'm
wrong. I'm wondring is it possible to retrieve sessions and cookies of
a remote server?

A "session" in the ASP sense needs a cookie that is kept on the
client/browser and defines the session. Session variables reside on the
server, but are only available to pagest that show the session cookie.

So if you fetch a page of another server on a server
[by asp code Server.CreateObject("MSXML2.ServerXMLHTTP")],
the session cookie should be on that server too without
any browser on that server. That seems impossible under ASP.
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Members online

Forum statistics

Threads
473,769
Messages
2,569,582
Members
45,057
Latest member
KetoBeezACVGummies

Latest Threads

Top