469,336 Members | 5,570 Online
Bytes | Developer Community
New Post

Home Posts Topics Members FAQ

Post your question to a community of 469,336 developers. It's quick & easy.

XMLHttp/AJAX and ASP Session variables

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
Aug 10 '05 #1
3 6302
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/codecha..._20_javas.html

Aug 10 '05 #2
On Wed, 10 Aug 2005 12:08:21 GMT, "Dag Sunde" <me@dagsunde.com> 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.
Aug 10 '05 #3
"Jim Ley" <ji*@jibbering.com> wrote in message
news:42*****************@news.individual.net...
On Wed, 10 Aug 2005 12:08:21 GMT, "Dag Sunde" <me@dagsunde.com> 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.

Aug 10 '05 #4

This discussion thread is closed

Replies have been disabled for this discussion.

Similar topics

5 posts views Thread by DS | last post: by
6 posts views Thread by Lina Manjarres | last post: by
31 posts views Thread by Harry Simpson | last post: by
3 posts views Thread by Phillip N Rounds | last post: by
6 posts views Thread by =?Utf-8?B?U2hhd24gU2VzbmE=?= | last post: by
reply views Thread by suresh191 | last post: by
reply views Thread by Marylou17 | last post: by
1 post views Thread by Marylou17 | last post: by
1 post views Thread by Marylou17 | last post: by
By using this site, you agree to our Privacy Policy and Terms of Use.