473,748 Members | 9,599 Online
Bytes | Software Development & Data Engineering Community
+ Post

Home Posts Topics Members FAQ

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 6495
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.co m> 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.co m> 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=VBScri pt %>
<%Response.Buff er = True%>
<%

' Works:
Application(Req uest.Form("uId" ) & "-transDate") = Request.Form("t ransDate")
Application(Req uest.Form("uId" ) & "-statusType") =
Request.Form("s tatusType")

' Does NOT work:
'Session("saved TransDate") = Request.Form("t ransDate")
'Session("saved StatusType") = Request.Form("s tatusType")

Response.Conten tType = "text/xml"
Response.CacheC ontrol = "Private"
Response.AddHea der "Cache-Control", "no-cache"
Response.Write "Ok"
Response.End()

%>

Any idea?

--
Dag.

Aug 10 '05 #4

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

9
3647
by: Pack Fan | last post by:
I've noticed that session variables will persist on Mac IE even after all browser windows have been closed. One must quit the program to clear the session variables. This presents a security risk for my session variable based security scheme. Basically, the risk is that a user will login to my site, close the window when done and allow someone else to come up to the machine, go back to my site and be logged into the previous user's...
8
3694
by: Karen | last post by:
Hi there.... i got a quick one for you guys. i've this session variable that is updated by calling a server method (i set this value when the user hits a submit button in my form. The server method is called when i load all my asp forms.). I'd like to be able to update this session variable, without being forced to submit my form or refresh my form (something that will call my server method each 2 min lets say, without refreshing my page...
5
23306
by: DS | last post by:
In client-side script (<script> codes </script>), how can set / get session variables' values? Pls advise. DS
6
656
by: Lina Manjarres | last post by:
Hello, I have a session variable in a login page. Then I go to a form page where I uses the ProfileID and the UserID. Then I go to a result page where I would like to use the UserID as a filter, but I can't get the value is stored in it. How can I do that? Thanks a lot!
4
5592
by: PJ | last post by:
A particular page seems to be having issues with correctly setting Session variables. I am setting a couple of session variables on the Page_Unload event. While stepping through code, the immediate window will show the values in Session after the relevant lines that set the variables in the Page_Unload event. However, on postback, these variables are no longer in Session. All Session variables that were set previous to that particular...
31
6999
by: Harry Simpson | last post by:
I've come from the old ASP camp where session variables were not used. When i started using ASP.NET in 2001, I started using them again because it was ok from what I'd read. I've been merrily using Session variables for three years now and i'm entering a project with my new boss who has never quite come around that session variables are ok. What's the concensus here. How can i convince him that they are ok in ASP.NET. OR
3
2679
by: Phillip N Rounds | last post by:
I'm writing a user control which has two states: Active & InActive. I additionally am required that there to be only one active control per page, and all logic has to be contained within the control. In its inactive state, only a single button appears. If the user clicks on this button, the control becomes active( the rest of the control's functionality becomes visible), and all other instances of this user control on the page should...
18
3444
by: BillE | last post by:
When a user opens a new IE browser window using File-New-Window the integrity of an application which relies on session state is COMPLETELY undermined. Anyone who overlooks the fact that File-New-Window creates an instance of IE in the same process with the same SessionID as the parent window is in big trouble. This fundamentally restricts the usefullness of using session state management. I probably missed it somewhere - can...
6
5166
by: =?Utf-8?B?U2hhd24gU2VzbmE=?= | last post by:
Greetings! I was researching AJAX to provide a solution to displaying status messages while a long process executed. I found several examples online and was able to use their code to get a quick application working. However, when attempting to implement the solution, the AJAX calls weren't updating the screen like the examples were and seemed not to fire until after the long running process had completed. I found the only real...
0
8991
marktang
by: marktang | last post by:
ONU (Optical Network Unit) is one of the key components for providing high-speed Internet services. Its primary function is to act as an endpoint device located at the user's premises. However, people are often confused as to whether an ONU can Work As a Router. In this blog post, we’ll explore What is ONU, What Is Router, ONU & Router’s main usage, and What is the difference between ONU and Router. Let’s take a closer look ! Part I. Meaning of...
0
8830
by: Hystou | last post by:
Most computers default to English, but sometimes we require a different language, especially when relocating. Forgot to request a specific language before your computer shipped? No problem! You can effortlessly switch the default language on Windows 10 without reinstalling. I'll walk you through it. First, let's disable language synchronization. With a Microsoft account, language settings sync across devices. To prevent any complications,...
0
9541
Oralloy
by: Oralloy | last post by:
Hello folks, I am unable to find appropriate documentation on the type promotion of bit-fields when using the generalised comparison operator "<=>". The problem is that using the GNU compilers, it seems that the internal comparison operator "<=>" tries to promote arguments from unsigned to signed. This is as boiled down as I can make it. Here is my compilation command: g++-12 -std=c++20 -Wnarrowing bit_field.cpp Here is the code in...
0
9370
jinu1996
by: jinu1996 | last post by:
In today's digital age, having a compelling online presence is paramount for businesses aiming to thrive in a competitive landscape. At the heart of this digital strategy lies an intricately woven tapestry of website design and digital marketing. It's not merely about having a website; it's about crafting an immersive digital experience that captivates audiences and drives business growth. The Art of Business Website Design Your website is...
1
9321
by: Hystou | last post by:
Overview: Windows 11 and 10 have less user interface control over operating system update behaviour than previous versions of Windows. In Windows 11 and 10, there is no way to turn off the Windows Update option using the Control Panel or Settings app; it automatically checks for updates and installs any it finds, whether you like it or not. For most users, this new feature is actually very convenient. If you want to control the update process,...
0
9247
tracyyun
by: tracyyun | last post by:
Dear forum friends, With the development of smart home technology, a variety of wireless communication protocols have appeared on the market, such as Zigbee, Z-Wave, Wi-Fi, Bluetooth, etc. Each protocol has its own unique characteristics and advantages, but as a user who is planning to build a smart home system, I am a bit confused by the choice of these technologies. I'm particularly interested in Zigbee because I've heard it does some...
0
4602
by: TSSRALBI | last post by:
Hello I'm a network technician in training and I need your help. I am currently learning how to create and manage the different types of VPNs and I have a question about LAN-to-LAN VPNs. The last exercise I practiced was to create a LAN-to-LAN VPN between two Pfsense firewalls, by using IPSEC protocols. I succeeded, with both firewalls in the same network. But I'm wondering if it's possible to do the same thing, with 2 Pfsense firewalls...
0
4874
by: adsilva | last post by:
A Windows Forms form does not have the event Unload, like VB6. What one acts like?
2
2782
muto222
by: muto222 | last post by:
How can i add a mobile payment intergratation into php mysql website.

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.