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.

Re: ServerXMLHTTP, session and cookies by Evertjan

Evertjan
Wed Jul 05 15:06:23 CDT 2006

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?

--
Evertjan.
The Netherlands.
(Please change the x'es to dots in my emailaddress)

Re: ServerXMLHTTP, session and cookies by Evertjan

Evertjan
Wed Jul 05 15:09:14 CDT 2006

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

> 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?
>

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

That will not do.

--
Evertjan.
The Netherlands.
(Please change the x'es to dots in my emailaddress)

Re: ServerXMLHTTP, session and cookies by mizi

mizi
Wed Jul 05 15:35:17 CDT 2006

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.

Re: ServerXMLHTTP, session and cookies by Evertjan

Evertjan
Wed Jul 05 17:35:16 CDT 2006

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

> Hi,

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.


--
Evertjan.
The Netherlands.
(Please change the x'es to dots in my emailaddress)