473,548 Members | 2,716 Online
Bytes | Software Development & Data Engineering Community
+ Post

Home Posts Topics Members FAQ

Session Variables getting cross threaded

Hello,
I'm having a strange problem. I've got a .NET web app which uses Session
variables. Sometime, not all the time, they get cross threaded...that
is...one user will have another user's Session variable(s) data assigned to
them. I can't figure out why. I've read that other people are having this
problem too but I haven't found a resolution yet. Can someone please tell me
how I might go about fixing this?

Thanks
Nov 19 '05 #1
9 3174
Hey Randy,

"Randy" <te**@temp.co m> wrote in message
news:O5******** *****@tk2msftng p13.phx.gbl...
Hello,
I'm having a strange problem. I've got a .NET web app which uses Session
variables. Sometime, not all the time, they get cross threaded...that
is...one user will have another user's Session variable(s) data assigned
to them. I can't figure out why. I've read that other people are having
this problem too but I haven't found a resolution yet. Can someone please
tell me how I might go about fixing this?


What's the environment? OS, IIS, etc...
Nov 19 '05 #2
Sorry, the app is using .NET v1.1.4322, the OS on the server is Server
2003...so I think the IIS version would be 6?
I'm wondering if it might be caused by using static variables?
Thanks for your help

"Christoph Wienands" <ch************ ****@siemens.re move.com> wrote in
message news:%2******** ********@TK2MSF TNGP12.phx.gbl. ..
Hey Randy,

"Randy" <te**@temp.co m> wrote in message
news:O5******** *****@tk2msftng p13.phx.gbl...
Hello,
I'm having a strange problem. I've got a .NET web app which uses Session
variables. Sometime, not all the time, they get cross threaded...that
is...one user will have another user's Session variable(s) data assigned
to them. I can't figure out why. I've read that other people are having
this problem too but I haven't found a resolution yet. Can someone please
tell me how I might go about fixing this?


What's the environment? OS, IIS, etc...

Nov 19 '05 #3
In particular...wh at is happening is...say two users are logged in. There is
a dropdown listbox which contains paypools. If the user changes paypools,
then the Session["paypool"] for that user is set to this. There are several
buttons on this page which go to different pages. One goes to a screen which
uses the Session["paypool"] object in a query (to Oracle) to populate this
new page. If both users click this button very close to the same time, the
second user will get the Session["paypool"] object of the other user.
"Christoph Wienands" <ch************ ****@siemens.re move.com> wrote in
message news:%2******** ********@TK2MSF TNGP12.phx.gbl. ..
Hey Randy,

"Randy" <te**@temp.co m> wrote in message
news:O5******** *****@tk2msftng p13.phx.gbl...
Hello,
I'm having a strange problem. I've got a .NET web app which uses Session
variables. Sometime, not all the time, they get cross threaded...that
is...one user will have another user's Session variable(s) data assigned
to them. I can't figure out why. I've read that other people are having
this problem too but I haven't found a resolution yet. Can someone please
tell me how I might go about fixing this?


What's the environment? OS, IIS, etc...

Nov 19 '05 #4
this is almost always a bug in the asp.net code. most likely you are storing
a reference to a session variable in vb module (shared). this is a no, no,
as vb module variables are shared across threads.

-- bruce (sqlwork.com)
"Randy" <te**@temp.co m> wrote in message
news:ew******** ******@tk2msftn gp13.phx.gbl...
In particular...wh at is happening is...say two users are logged in. There
is a dropdown listbox which contains paypools. If the user changes
paypools, then the Session["paypool"] for that user is set to this. There
are several buttons on this page which go to different pages. One goes to
a screen which uses the Session["paypool"] object in a query (to Oracle)
to populate this new page. If both users click this button very close to
the same time, the second user will get the Session["paypool"] object of
the other user.
"Christoph Wienands" <ch************ ****@siemens.re move.com> wrote in
message news:%2******** ********@TK2MSF TNGP12.phx.gbl. ..
Hey Randy,

"Randy" <te**@temp.co m> wrote in message
news:O5******** *****@tk2msftng p13.phx.gbl...
Hello,
I'm having a strange problem. I've got a .NET web app which uses Session
variables. Sometime, not all the time, they get cross threaded...that
is...one user will have another user's Session variable(s) data assigned
to them. I can't figure out why. I've read that other people are having
this problem too but I haven't found a resolution yet. Can someone
please tell me how I might go about fixing this?


What's the environment? OS, IIS, etc...


Nov 19 '05 #5
My app is in C#. I'm not very familiar with VB...the VB Module you're saying
is shared across threads? I didn't know that. But in my C# app, I'm not
sharing it that I'm aware of.
Thanks
"Bruce Barker" <br************ ******@safeco.c om> wrote in message
news:%2******** ********@TK2MSF TNGP09.phx.gbl. ..
this is almost always a bug in the asp.net code. most likely you are
storing a reference to a session variable in vb module (shared). this is a
no, no, as vb module variables are shared across threads.

-- bruce (sqlwork.com)
"Randy" <te**@temp.co m> wrote in message
news:ew******** ******@tk2msftn gp13.phx.gbl...
In particular...wh at is happening is...say two users are logged in. There
is a dropdown listbox which contains paypools. If the user changes
paypools, then the Session["paypool"] for that user is set to this. There
are several buttons on this page which go to different pages. One goes to
a screen which uses the Session["paypool"] object in a query (to Oracle)
to populate this new page. If both users click this button very close to
the same time, the second user will get the Session["paypool"] object of
the other user.
"Christoph Wienands" <ch************ ****@siemens.re move.com> wrote in
message news:%2******** ********@TK2MSF TNGP12.phx.gbl. ..
Hey Randy,

"Randy" <te**@temp.co m> wrote in message
news:O5******** *****@tk2msftng p13.phx.gbl...
Hello,
I'm having a strange problem. I've got a .NET web app which uses
Session variables. Sometime, not all the time, they get cross
threaded...that is...one user will have another user's Session
variable(s) data assigned to them. I can't figure out why. I've read
that other people are having this problem too but I haven't found a
resolution yet. Can someone please tell me how I might go about fixing
this?

What's the environment? OS, IIS, etc...



Nov 19 '05 #6
Do you have static variables ? They are shared by the whole application
(i.e. all sessions using *the* application).

--
Patrice

"Randy" <te**@temp.co m> a écrit dans le message de
news:Oz******** ******@TK2MSFTN GP12.phx.gbl...
My app is in C#. I'm not very familiar with VB...the VB Module you're saying is shared across threads? I didn't know that. But in my C# app, I'm not
sharing it that I'm aware of.
Thanks
"Bruce Barker" <br************ ******@safeco.c om> wrote in message
news:%2******** ********@TK2MSF TNGP09.phx.gbl. ..
this is almost always a bug in the asp.net code. most likely you are
storing a reference to a session variable in vb module (shared). this is a no, no, as vb module variables are shared across threads.

-- bruce (sqlwork.com)
"Randy" <te**@temp.co m> wrote in message
news:ew******** ******@tk2msftn gp13.phx.gbl...
In particular...wh at is happening is...say two users are logged in. There is a dropdown listbox which contains paypools. If the user changes
paypools, then the Session["paypool"] for that user is set to this. There are several buttons on this page which go to different pages. One goes to a screen which uses the Session["paypool"] object in a query (to Oracle) to populate this new page. If both users click this button very close to the same time, the second user will get the Session["paypool"] object of the other user.
"Christoph Wienands" <ch************ ****@siemens.re move.com> wrote in
message news:%2******** ********@TK2MSF TNGP12.phx.gbl. ..
Hey Randy,

"Randy" <te**@temp.co m> wrote in message
news:O5******** *****@tk2msftng p13.phx.gbl...
> Hello,
> I'm having a strange problem. I've got a .NET web app which uses
> Session variables. Sometime, not all the time, they get cross
> threaded...that is...one user will have another user's Session
> variable(s) data assigned to them. I can't figure out why. I've read
> that other people are having this problem too but I haven't found a
> resolution yet. Can someone please tell me how I might go about fixing> this?

What's the environment? OS, IIS, etc...



Nov 19 '05 #7
Yes, I do have static variables. I'm not using any of them (that I know of)
to assign a value directly to a Session variable, but use of static
variables sounds like that might be what is causing it? Should I not use any
static variables?
"Patrice" <no****@nowhere .com> wrote in message
news:OY******** ********@tk2msf tngp13.phx.gbl. ..
Do you have static variables ? They are shared by the whole application
(i.e. all sessions using *the* application).

--
Patrice

"Randy" <te**@temp.co m> a écrit dans le message de
news:Oz******** ******@TK2MSFTN GP12.phx.gbl...
My app is in C#. I'm not very familiar with VB...the VB Module you're

saying
is shared across threads? I didn't know that. But in my C# app, I'm not
sharing it that I'm aware of.
Thanks
"Bruce Barker" <br************ ******@safeco.c om> wrote in message
news:%2******** ********@TK2MSF TNGP09.phx.gbl. ..
> this is almost always a bug in the asp.net code. most likely you are
> storing a reference to a session variable in vb module (shared). this
> is a > no, no, as vb module variables are shared across threads.
>
> -- bruce (sqlwork.com)
>
>
> "Randy" <te**@temp.co m> wrote in message
> news:ew******** ******@tk2msftn gp13.phx.gbl...
>> In particular...wh at is happening is...say two users are logged in. There >> is a dropdown listbox which contains paypools. If the user changes
>> paypools, then the Session["paypool"] for that user is set to this. There >> are several buttons on this page which go to different pages. One goes to >> a screen which uses the Session["paypool"] object in a query (to Oracle) >> to populate this new page. If both users click this button very close to >> the same time, the second user will get the Session["paypool"] object of >> the other user.
>>
>>
>> "Christoph Wienands" <ch************ ****@siemens.re move.com> wrote in
>> message news:%2******** ********@TK2MSF TNGP12.phx.gbl. ..
>>> Hey Randy,
>>>
>>> "Randy" <te**@temp.co m> wrote in message
>>> news:O5******** *****@tk2msftng p13.phx.gbl...
>>>> Hello,
>>>> I'm having a strange problem. I've got a .NET web app which uses
>>>> Session variables. Sometime, not all the time, they get cross
>>>> threaded...that is...one user will have another user's Session
>>>> variable(s) data assigned to them. I can't figure out why. I've read
>>>> that other people are having this problem too but I haven't found a
>>>> resolution yet. Can someone please tell me how I might go about fixing >>>> this?
>>>
>>> What's the environment? OS, IIS, etc...
>>>
>>
>>
>
>



Nov 19 '05 #8
Do you affect a session value to such a variable ?

Those variables have an application wide scope. In the case of ASP.NET, it
means they are shared accross all sessions. So you 'll usually won't want
them in an ASP.NET application.

(using a shared property that return the value from the session variable
would work and could be a quick way to fix this problem).

--
Patrice

"Randy" <te**@temp.co m> a écrit dans le message de
news:Or******** ******@TK2MSFTN GP10.phx.gbl...
Yes, I do have static variables. I'm not using any of them (that I know of) to assign a value directly to a Session variable, but use of static
variables sounds like that might be what is causing it? Should I not use any static variables?
"Patrice" <no****@nowhere .com> wrote in message
news:OY******** ********@tk2msf tngp13.phx.gbl. ..
Do you have static variables ? They are shared by the whole application
(i.e. all sessions using *the* application).

--
Patrice

"Randy" <te**@temp.co m> a écrit dans le message de
news:Oz******** ******@TK2MSFTN GP12.phx.gbl...
My app is in C#. I'm not very familiar with VB...the VB Module you're

saying
is shared across threads? I didn't know that. But in my C# app, I'm not
sharing it that I'm aware of.
Thanks
"Bruce Barker" <br************ ******@safeco.c om> wrote in message
news:%2******** ********@TK2MSF TNGP09.phx.gbl. ..
> this is almost always a bug in the asp.net code. most likely you are
> storing a reference to a session variable in vb module (shared). this
> is

a
> no, no, as vb module variables are shared across threads.
>
> -- bruce (sqlwork.com)
>
>
> "Randy" <te**@temp.co m> wrote in message
> news:ew******** ******@tk2msftn gp13.phx.gbl...
>> In particular...wh at is happening is...say two users are logged in.

There
>> is a dropdown listbox which contains paypools. If the user changes
>> paypools, then the Session["paypool"] for that user is set to this.

There
>> are several buttons on this page which go to different pages. One goes
to
>> a screen which uses the Session["paypool"] object in a query (to

Oracle)
>> to populate this new page. If both users click this button very
close to
>> the same time, the second user will get the Session["paypool"]
object of
>> the other user.
>>
>>
>> "Christoph Wienands" <ch************ ****@siemens.re move.com> wrote

in >> message news:%2******** ********@TK2MSF TNGP12.phx.gbl. ..
>>> Hey Randy,
>>>
>>> "Randy" <te**@temp.co m> wrote in message
>>> news:O5******** *****@tk2msftng p13.phx.gbl...
>>>> Hello,
>>>> I'm having a strange problem. I've got a .NET web app which uses
>>>> Session variables. Sometime, not all the time, they get cross
>>>> threaded...that is...one user will have another user's Session
>>>> variable(s) data assigned to them. I can't figure out why. I've read >>>> that other people are having this problem too but I haven't found a >>>> resolution yet. Can someone please tell me how I might go about

fixing
>>>> this?
>>>
>>> What's the environment? OS, IIS, etc...
>>>
>>
>>
>
>



Nov 19 '05 #9
I was using a static in the screen (aspx file) where the anomaly was
occuring. I took out the static and slightly recoded and I believe it fixed
it! I can't seem to reproduce the anomaly. I'll keep testing, but I really
appreciate everyones help!
I'll never use static in an ASP app again :)
Thanks!

"Patrice" <no****@nowhere .com> wrote in message
news:OJ******** ******@TK2MSFTN GP09.phx.gbl...
Do you affect a session value to such a variable ?

Those variables have an application wide scope. In the case of ASP.NET, it
means they are shared accross all sessions. So you 'll usually won't want
them in an ASP.NET application.

(using a shared property that return the value from the session variable
would work and could be a quick way to fix this problem).

--
Patrice

"Randy" <te**@temp.co m> a écrit dans le message de
news:Or******** ******@TK2MSFTN GP10.phx.gbl...
Yes, I do have static variables. I'm not using any of them (that I know

of)
to assign a value directly to a Session variable, but use of static
variables sounds like that might be what is causing it? Should I not use

any
static variables?
"Patrice" <no****@nowhere .com> wrote in message
news:OY******** ********@tk2msf tngp13.phx.gbl. ..
> Do you have static variables ? They are shared by the whole application
> (i.e. all sessions using *the* application).
>
> --
> Patrice
>
> "Randy" <te**@temp.co m> a écrit dans le message de
> news:Oz******** ******@TK2MSFTN GP12.phx.gbl...
>> My app is in C#. I'm not very familiar with VB...the VB Module you're
> saying
>> is shared across threads? I didn't know that. But in my C# app, I'm
>> not
>> sharing it that I'm aware of.
>> Thanks
>>
>>
>> "Bruce Barker" <br************ ******@safeco.c om> wrote in message
>> news:%2******** ********@TK2MSF TNGP09.phx.gbl. ..
>> > this is almost always a bug in the asp.net code. most likely you are
>> > storing a reference to a session variable in vb module (shared).
>> > this
>> > is
> a
>> > no, no, as vb module variables are shared across threads.
>> >
>> > -- bruce (sqlwork.com)
>> >
>> >
>> > "Randy" <te**@temp.co m> wrote in message
>> > news:ew******** ******@tk2msftn gp13.phx.gbl...
>> >> In particular...wh at is happening is...say two users are logged in.
> There
>> >> is a dropdown listbox which contains paypools. If the user changes
>> >> paypools, then the Session["paypool"] for that user is set to this.
> There
>> >> are several buttons on this page which go to different pages. One goes > to
>> >> a screen which uses the Session["paypool"] object in a query (to
> Oracle)
>> >> to populate this new page. If both users click this button very close > to
>> >> the same time, the second user will get the Session["paypool"] object > of
>> >> the other user.
>> >>
>> >>
>> >> "Christoph Wienands" <ch************ ****@siemens.re move.com> wrote in >> >> message news:%2******** ********@TK2MSF TNGP12.phx.gbl. ..
>> >>> Hey Randy,
>> >>>
>> >>> "Randy" <te**@temp.co m> wrote in message
>> >>> news:O5******** *****@tk2msftng p13.phx.gbl...
>> >>>> Hello,
>> >>>> I'm having a strange problem. I've got a .NET web app which uses
>> >>>> Session variables. Sometime, not all the time, they get cross
>> >>>> threaded...that is...one user will have another user's Session
>> >>>> variable(s) data assigned to them. I can't figure out why. I've read >> >>>> that other people are having this problem too but I haven't found a >> >>>> resolution yet. Can someone please tell me how I might go about
> fixing
>> >>>> this?
>> >>>
>> >>> What's the environment? OS, IIS, etc...
>> >>>
>> >>
>> >>
>> >
>> >
>>
>>
>
>



Nov 19 '05 #10

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

Similar topics

9
15833
by: Joel Brabant | last post by:
How can I know if a user session had timed out ? I always get an error in my asp page when I try to access my session variable if it timed out. Thank You.
14
2586
by: mjkahn | last post by:
I've read (and read!) that you shouldn't store objects in Session variables. I've read these reasons: - The object takes up memory that may not be freed until the session times out. Better to create the object only when you actually use it. - Causes poor performance because the thread that created the object has to service all requests...
7
2300
by: Adam Short | last post by:
I'm having all sorts of problems with Sessions, I've been using them for years with out a hitch, all of a sudden the last 6 - 12 months since getting our new Win2003 server it's all gone shakey!!! Our development server started life as an NT4 machine and has been simply upgraded from one operating system to the next, it is now a cross, NT4...
6
5418
by: Ilia | last post by:
Hi folks, I have some problems with ASP.NET Session State. The following simple program runs well if the Session State set as "InProc". If I switch to "SQLServer", the changes, made by the second thread, are lost. Any idea? I use VS.NET 2003 on Windows Server 2003 with hot fixes (as of 30-Oct-2003) and SQL Server 2000 SP 3a.
4
2039
by: Cowboy \(Gregory A. Beamer\) | last post by:
Background: ------------- The idea started as a single sign on type of application. Having tested it before, I knew we could institute single sign on using the same Authentication Cookie name (in this case "AuthenticationCookie" -- yeah, original, I know) and the same machine keys for the applications. <authentication mode="Forms"> <forms...
2
337
by: fizbang | last post by:
This should be impossible, but for some reason, people are not getting individual sessions. They start a session. I set the session("application") variable to the unique number generated by an identity column on our sql server. I only set session("application") at the begiinning and it should stay the same as they fill out the...
1
1971
by: Larry Neylon | last post by:
Hi, I'm working on a VBScript application on IIS6 and I'm looking for some advice about the best way of replacing or improving session variable usage. The application is in a secure extranet environment. Currently the application has a search customers page with 10 search fields which list the results below the search fields. The...
3
1461
by: CBKowitz | last post by:
Has anyone encountered this problem? I start debugging my application and the session get reset (as far as I can tell). I then stop and restart and everything is fine. Basically the symptoms are as follows: after starting the application, everything is fine and the session variables are set. I get to my 'main' page and click on a button...
4
2330
by: Jack Black | last post by:
Hi, all! Developed a basic ASP web site with MS Access 2k3 as a database back end. I've developed it on two different Win2k3 servers, and app works flawlessly on both. However, we just moved it to a client's Win2k3 Server, and it's not holding any session variables. It IS, however, holding Application variables, but not session variables. ...
0
7444
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...
0
7711
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. ...
0
7954
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...
1
7467
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...
0
7805
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...
0
6039
agi2029
by: agi2029 | last post by:
Let's talk about the concept of autonomous AI software engineers and no-code agents. These AIs are designed to manage the entire lifecycle of a software development project—planning, coding, testing, and deployment—without human intervention. Imagine an AI that can take a project description, break it down, write the code, debug it, and then...
0
5085
by: conductexam | last post by:
I have .net C# application in which I am extracting data from word file and save it in database particularly. To store word all data as it is I am converting the whole word file firstly in HTML and then checking html paragraph one by one. At the time of converting from word file to html my equations which are in the word document file was convert...
1
1932
by: 6302768590 | last post by:
Hai team i want code for transfer the data from one system to another through IP address by using C# our system has to for every 5mins then we have to update the data what the data is updated we have to send another system
1
1054
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.