By using this site, you agree to our updated Privacy Policy and our Terms of Use. Manage your Cookies Settings.
457,695 Members | 1,237 Online
Bytes IT Community
+ Ask a Question
Need help? Post your question and get tips & solutions from a community of 457,695 IT Pros & Developers. It's quick & easy.

Session Variables getting cross threaded

P: n/a
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
Share this Question
Share on Google+
9 Replies


P: n/a
Hey Randy,

"Randy" <te**@temp.com> wrote in message
news:O5*************@tk2msftngp13.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

P: n/a
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.remove.com> wrote in
message news:%2****************@TK2MSFTNGP12.phx.gbl...
Hey Randy,

"Randy" <te**@temp.com> wrote in message
news:O5*************@tk2msftngp13.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

P: n/a
In particular...what 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.remove.com> wrote in
message news:%2****************@TK2MSFTNGP12.phx.gbl...
Hey Randy,

"Randy" <te**@temp.com> wrote in message
news:O5*************@tk2msftngp13.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

P: n/a
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.com> wrote in message
news:ew**************@tk2msftngp13.phx.gbl...
In particular...what 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.remove.com> wrote in
message news:%2****************@TK2MSFTNGP12.phx.gbl...
Hey Randy,

"Randy" <te**@temp.com> wrote in message
news:O5*************@tk2msftngp13.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

P: n/a
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.com> wrote in message
news:%2****************@TK2MSFTNGP09.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.com> wrote in message
news:ew**************@tk2msftngp13.phx.gbl...
In particular...what 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.remove.com> wrote in
message news:%2****************@TK2MSFTNGP12.phx.gbl...
Hey Randy,

"Randy" <te**@temp.com> wrote in message
news:O5*************@tk2msftngp13.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

P: n/a
Do you have static variables ? They are shared by the whole application
(i.e. all sessions using *the* application).

--
Patrice

"Randy" <te**@temp.com> a écrit dans le message de
news:Oz**************@TK2MSFTNGP12.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.com> wrote in message
news:%2****************@TK2MSFTNGP09.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.com> wrote in message
news:ew**************@tk2msftngp13.phx.gbl...
In particular...what 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.remove.com> wrote in
message news:%2****************@TK2MSFTNGP12.phx.gbl...
Hey Randy,

"Randy" <te**@temp.com> wrote in message
news:O5*************@tk2msftngp13.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

P: n/a
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****************@tk2msftngp13.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.com> a écrit dans le message de
news:Oz**************@TK2MSFTNGP12.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.com> wrote in message
news:%2****************@TK2MSFTNGP09.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.com> wrote in message
> news:ew**************@tk2msftngp13.phx.gbl...
>> In particular...what 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.remove.com> wrote in
>> message news:%2****************@TK2MSFTNGP12.phx.gbl...
>>> Hey Randy,
>>>
>>> "Randy" <te**@temp.com> wrote in message
>>> news:O5*************@tk2msftngp13.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

P: n/a
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.com> a écrit dans le message de
news:Or**************@TK2MSFTNGP10.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****************@tk2msftngp13.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.com> a écrit dans le message de
news:Oz**************@TK2MSFTNGP12.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.com> wrote in message
news:%2****************@TK2MSFTNGP09.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.com> wrote in message
> news:ew**************@tk2msftngp13.phx.gbl...
>> In particular...what 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.remove.com> wrote

in >> message news:%2****************@TK2MSFTNGP12.phx.gbl...
>>> Hey Randy,
>>>
>>> "Randy" <te**@temp.com> wrote in message
>>> news:O5*************@tk2msftngp13.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

P: n/a
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**************@TK2MSFTNGP09.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.com> a écrit dans le message de
news:Or**************@TK2MSFTNGP10.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****************@tk2msftngp13.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.com> a écrit dans le message de
> news:Oz**************@TK2MSFTNGP12.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.com> wrote in message
>> news:%2****************@TK2MSFTNGP09.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.com> wrote in message
>> > news:ew**************@tk2msftngp13.phx.gbl...
>> >> In particular...what 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.remove.com> wrote in >> >> message news:%2****************@TK2MSFTNGP12.phx.gbl...
>> >>> Hey Randy,
>> >>>
>> >>> "Randy" <te**@temp.com> wrote in message
>> >>> news:O5*************@tk2msftngp13.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 discussion thread is closed

Replies have been disabled for this discussion.