XMLHttp/AJAX and ASP Session variables

Discussion in 'Javascript' started by Dag Sunde, Aug 10, 2005.

  1. Dag Sunde

    Dag Sunde Guest

    I'm trying to call an ASP script with the XMLHttp object in
    Client-side Javascript (which goes well).

    My problem is that the server gives me an error when I try
    to set a Session variable in the called asp-script:
    "Type Mismatch: Session".

    I guess it is because it is the XMLHttp object that is now the
    client (from the servers point ov view), and that object does
    not share the session with the client-browser containing the
    script.

    Is there any way to convince the server that a request from
    the XMLHttp object belongs to the same session as the page
    that contains it?

    Or another way to set session variables with XmlHttp that can
    later be read by other pages?

    --
    Dag.

    Work is the curse of the drinking classes
    -- Oscar Wilde
     
    Dag Sunde, Aug 10, 2005
    #1
    1. Advertising

  2. Dag Sunde

    Guest

    Seeing that your are using ASP I am not sure how the "session" is
    handled, I known that in ASP.NET that the session is available on the
    at the server for the same web application, if you cross web
    applications then it is a different session object.

    ============================
    If it is any help I have come across a method to debug ajax script into
    server-side code, I am not sure if it will work with classic ASP, but
    you may want to use the latest Script Debugger from MS. This may
    assist you with a least step-thru the code soe you can better see waht
    is going on.

    No matter here are the instructions on how to debug Ajax and ASP.NET

    http://codechasers.blogs.com/codechasers/2005/08/aspnet_20_javas.html
     
    , Aug 10, 2005
    #2
    1. Advertising

  3. Dag Sunde

    Jim Ley Guest

    On Wed, 10 Aug 2005 12:08:21 GMT, "Dag Sunde" <> wrote:

    >Is there any way to convince the server that a request from
    >the XMLHttp object belongs to the same session as the page
    >that contains it?


    It will do, by default, always, your problem must be somewhere else.

    Jim.
     
    Jim Ley, Aug 10, 2005
    #3
  4. Dag Sunde

    Dag Sunde Guest

    "Jim Ley" <> wrote in message
    news:...
    > On Wed, 10 Aug 2005 12:08:21 GMT, "Dag Sunde" <> wrote:
    >
    >>Is there any way to convince the server that a request from
    >>the XMLHttp object belongs to the same session as the page
    >>that contains it?

    >
    > It will do, by default, always, your problem must be somewhere else.
    >


    Good to hear... (I had a suspicion, because I can create
    Application(...) vars , but not Session(...) vars):

    This is the asp script i call with XMLHttp:

    <%@ Language=VBScript %>
    <%Response.Buffer = True%>
    <%

    ' Works:
    Application(Request.Form("uId") & "-transDate") = Request.Form("transDate")
    Application(Request.Form("uId") & "-statusType") =
    Request.Form("statusType")

    ' Does NOT work:
    'Session("savedTransDate") = Request.Form("transDate")
    'Session("savedStatusType") = Request.Form("statusType")

    Response.ContentType = "text/xml"
    Response.CacheControl = "Private"
    Response.AddHeader "Cache-Control", "no-cache"
    Response.Write "Ok"
    Response.End()

    %>

    Any idea?

    --
    Dag.
     
    Dag Sunde, Aug 10, 2005
    #4
    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. Grant Merwitz

    XmlHttp (AJAX) and postbacl

    Grant Merwitz, Aug 18, 2005, in forum: ASP .Net
    Replies:
    2
    Views:
    371
    Grant Merwitz
    Aug 19, 2005
  2. minnie
    Replies:
    1
    Views:
    737
    Andrew Thompson
    Dec 13, 2006
  3. NonNB

    Ajax / Native XMLHTTP and Proxies

    NonNB, Oct 5, 2007, in forum: ASP .Net
    Replies:
    0
    Views:
    469
    NonNB
    Oct 5, 2007
  4. yawnmoth

    Msxml*.XMLHTTP vs. Microsoft.XMLHTTP

    yawnmoth, Nov 7, 2006, in forum: Javascript
    Replies:
    11
    Views:
    424
    Matt Kruse
    Nov 9, 2006
  5. Jay
    Replies:
    2
    Views:
    157
    Bart Van der Donck
    Oct 15, 2007
Loading...

Share This Page