ServerXMLHTTP, session and cookies

Discussion in 'ASP General' started by mizi, Jul 5, 2006.

  1. mizi

    mizi Guest

    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.
    mizi, Jul 5, 2006
    #1
    1. Advertising

  2. mizi

    Evertjan. Guest

    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)
    Evertjan., Jul 5, 2006
    #2
    1. Advertising

  3. mizi

    Evertjan. Guest

    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)
    Evertjan., Jul 5, 2006
    #3
  4. mizi

    mizi Guest

    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.
    mizi, Jul 5, 2006
    #4
  5. mizi

    Evertjan. Guest

    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)
    Evertjan., Jul 5, 2006
    #5
    1. Advertising

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

It takes just 2 minutes to sign up (and it's free!). Just click the sign up button to choose a username and then you can ask your own questions on the forum.
Similar Threads
  1. Andy Fish
    Replies:
    3
    Views:
    6,524
    Fredrik Lindner
    Nov 6, 2003
  2. _Who
    Replies:
    7
    Views:
    2,656
  3. katrinaVictim@.

    msxml2.serverXMLhttp and response.binarywrite

    katrinaVictim@., Oct 16, 2005, in forum: ASP General
    Replies:
    4
    Views:
    320
    McKirahan
    Oct 17, 2005
  4. Dana
    Replies:
    3
    Views:
    189
    Egbert Nierop \(MVP for IIS\)
    Nov 11, 2005
  5. Jen
    Replies:
    1
    Views:
    187
Loading...

Share This Page