XMLHttp/AJAX and ASP Session variables

D

Dag Sunde

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

tkelly

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
 
J

Jim Ley

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.
 
D

Dag Sunde

Jim Ley said:
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?
 

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,768
Messages
2,569,575
Members
45,053
Latest member
billing-software

Latest Threads

Top