Showing posts with label time. Show all posts
Showing posts with label time. Show all posts

Thursday, March 29, 2012

Session value gone

I have an app. where a user logs in and it fills two main session var. to be used the whole time they are logged in. How can I check if they are empty or not while my app is running w/out having to do a check on each page ?Because then I want to redirect them to my login page.I assume your having them login, when they login correctly, your setting a session variable with a username or something simliar. I believe you have to do a check on each page if that page is to be secured for "loged in users" only.
http://www.dnzone.com/ShowDetail.asp?NewsId=565
This article may be of interest to you.

The easiest way is just to check on every page. If you want to get fancy, create a class implementing the IHttpModule interface and do it there.
NC...

Thanks you both, just copied same code to each page load event. Thanks.

What am I doing wrong? I put the following code and it doesn't show the alert screen.
If Session("companyID")="" Or Session("facilityID") = ""Then
'Generates the message:
Dim strMessageAsString
strMessage = "You have been inactive for more than 30 minutes. You must Login to Continue."
'finishes server processing, returns to client.
Dim strScriptAsString = "<script language=JavaScript>"
strScript += "alert(""" & strMessage & """);"
strScript += "</script>"
If (Not Page.IsStartupScriptRegistered("clientScript"))Then
Page.RegisterStartupScript("clientScript", strScript)
Response.Redirect("LogIn.aspx")
EndIf
EndIf
FOR ANSWER GO HEREhttp://forums.asp.net/1100617/ShowPost.aspx


Try this in your global.asax code behind:
Sub Application_PreRequestHandlerExecute(ByVal sender As Object, ByVal e As EventArgs)
Dim url As Array
url = HttpContext.Current.Request.Url.Segments
If IsNothing(Session("UserID")) Then
If url.IndexOf(url, "Login.aspx") = -1 Then
Response.Redirect("Login.aspx")
End If
End If
End Sub
This redirects anyone who does not have a Session("UserID"). If the request was to the login.aspx page, then we do nothing in order to avoid an infinate loop.
If you want to send them to an "Expired.htm" page, just add the following in the place of Response.Redirect("Login.aspx"):
If Session.IsNewSession Then
Response.Redirect("Login.aspx")
Else
Response.Redirect("Expired.htm")
End If
Hope this helps!
Paul


Ecc solution is the best but if you don't want to mess with the global.asax file then just create a secure base page that all your secured pages can inheirit from and then put the check in there or else you are going to have to modify all your pages if you ever need to make a change. Better to keep the code in one spot for maintenance purposes.

Session Variable

Hello...

I have a simple problem...when I create a session variable as such:

Session("ID") = 1

and read this varaible from time to time...

The problem is that it is shared by all users not just the user that
created the session variable...

That is, if another user logs on and sets

Session("ID") = 2

then this will change the value if Session("ID") for the first
user...

What I want is to have different ID's for each user...

Can someone elxplain what is wrong?

Thanks...It shouldn't happen and I've never seent that. Are you sure this is
System.Web.HttpContext.Current.Session and not some other cusom session
object. You can also dump the SessionID to see if this is the same value (is
this hardcoded somewhere ?). What if you do a bare bone sample that shoes
that in your dev server on a bare bone site. Do you have the same problem ?

Ah ! Do you open another window and test to check this ? Note that when you
open another window (without relancunhing i..e) the new window uses the same
session.

--
Patrice

"Flurry" <cj406168@.stmail.staffs.ac.uka crit dans le message de news:
1189422564.511977.244720@.d55g2000hsg.googlegroups. com...

Quote:

Originally Posted by

Hello...
>
I have a simple problem...when I create a session variable as such:
>
Session("ID") = 1
>
and read this varaible from time to time...
>
The problem is that it is shared by all users not just the user that
created the session variable...
>
That is, if another user logs on and sets
>
Session("ID") = 2
>
then this will change the value if Session("ID") for the first
user...
>
What I want is to have different ID's for each user...
>
Can someone elxplain what is wrong?
>
Thanks...
>


You must be doing something else in your code that you haven't shown, or you
are using another Browser window from the same session, because this is
definitely *not* the expected behavior.
-- Peter
Recursion: see Recursion
site: http://www.eggheadcafe.com
unBlog: http://petesbloggerama.blogspot.com
BlogMetaFinder: http://www.blogmetafinder.com
"Flurry" wrote:

Quote:

Originally Posted by

Hello...
>
I have a simple problem...when I create a session variable as such:
>
Session("ID") = 1
>
and read this varaible from time to time...
>
The problem is that it is shared by all users not just the user that
created the session variable...
>
That is, if another user logs on and sets
>
Session("ID") = 2
>
then this will change the value if Session("ID") for the first
user...
>
What I want is to have different ID's for each user...
>
Can someone elxplain what is wrong?
>
Thanks...
>
>


Hello and thank you both for your reply...

This is strange...the code is very simple...I have two aspx pages:-

Page 1 has the following code

System.Web.HttpContext.Current.Session ("Country" ) = countryCode
server.transfer("FOTrans.aspx")

FOTrans.aspx just reads the country code as follows...

countryCode = System.Web.HttpContext.Current.Session("country")

However, as I said before the session variable is shared between
users. I have just tried logging on using two different PC's and the
problem exists. If I set Session("Country") to USA on the first pc
then set it to UK in the second pc, the first pc reads UK not USA...

Any ideas as to what could be wrong?

Thanks...
re:
!System.Web.HttpContext.Current.Session ("Country" ) = countryCode

Where dos the value for countryCode come from ?

Juan T. Llibre, asp.net MVP
asp.net faq : http://asp.net.do/faq/
foros de asp.net, en espaol : http://asp.net.do/foros/
======================================
"Flurry" <cj406168@.stmail.staffs.ac.ukwrote in message news:1189430823.328225.66540@.57g2000hsv.googlegrou ps.com...

Quote:

Originally Posted by

Hello and thank you both for your reply...
>
This is strange...the code is very simple...I have two aspx pages:-
>
Page 1 has the following code
>
System.Web.HttpContext.Current.Session ("Country" ) = countryCode
server.transfer("FOTrans.aspx")
>
FOTrans.aspx just reads the country code as follows...
>
countryCode = System.Web.HttpContext.Current.Session("country")
>
However, as I said before the session variable is shared between
users. I have just tried logging on using two different PC's and the
problem exists. If I set Session("Country") to USA on the first pc
then set it to UK in the second pc, the first pc reads UK not USA...
>
Any ideas as to what could be wrong?
>
Thanks...
>
>
>


Thanks for your replies...however, I've discovered my mistake...I'm
using a shared variable to hold the Session("Country") e.g.

Shared countryCode as String.
CountryCode = Session("Country")

I was using the shred variable as a global variable...I just didn't
realise that shared variables have scope outside their own session.
This is right isn't it?

Thanks for your help...
"Flurry" <cj406168@.stmail.staffs.ac.ukwrote in message
news:1189433300.687467.258850@.50g2000hsm.googlegro ups.com...

Quote:

Originally Posted by

Thanks for your replies...however, I've discovered my mistake...I'm
using a shared variable to hold the Session("Country") e.g.
>
Shared countryCode as String.
CountryCode = Session("Country")
>
I was using the shared variable as a global variable...I just didn't
realise that shared variables have scope outside their own session.
This is right isn't it?


Yes it is. Shared variables in ASP.NET need *extremely* careful
management...

Avoid them if you can...

--
Mark Rae
ASP.NET MVP
http://www.markrae.net
re:
!shared variables have scope outside their own session.
!This is right isn't it?

Exactly, and that is why I asked where that value came from.
I suspected you were setting a global variable.

Juan T. Llibre, asp.net MVP
asp.net faq : http://asp.net.do/faq/
foros de asp.net, en espaol : http://asp.net.do/foros/
======================================
"Flurry" <cj406168@.stmail.staffs.ac.ukwrote in message news:1189433300.687467.258850@.50g2000hsm.googlegro ups.com...

Quote:

Originally Posted by

Thanks for your replies...however, I've discovered my mistake...I'm
using a shared variable to hold the Session("Country") e.g.
>
Shared countryCode as String.
CountryCode = Session("Country")
>
I was using the shred variable as a global variable...I just didn't
realise that shared variables have scope outside their own session.
This is right isn't it?
>
Thanks for your help...
>
>

Thursday, March 22, 2012

Session variables

This is a very wierd problem, but I have a ssimple log on page that never works the first time you use it. For example, if you successfully log into the page, it redirects you to the default page after setting a session variable. The first time you successfully log in, you get redirected to the default page, but no session variables are created. The second time you successfully log in, the session variables are created and the redirect happens.

The log on must always be done twice for the session to be created. And I know it's not a problem with mistyping the login or password because if that happens you get the invalid password message.

Also when I logout, which simply calls Session.Abandon() and then redirects, I must also do this twice before the session is abandoned.

Has anyone had problems like this?It's hard to guess without seeing the code but when I get different values (or no values) where certain values are expected, I insert a Trace.Warn() statements (enable tracing first) to track where the problem is originating from. That can tell me alot.

Also Session.Abandon() doesn't dereference the object automatically. It only becomes unavailable in the next request. IOW, it requires another request to realize the empty session.

If this doesn't help, feel free to post further details.

Session variables

I see Session variables time out after 20 minutes (or whatever number of minutes you define)
I want to have some variables that won't time out, but they only occupy very small amounts of data, say 10-20 bytes per user, so I think it won't too much of a performance impact to store it in the web server's memory. Would having hash tables as global variables using the SessionID as key work OK? Global variables and SessionIDs don't time out do they?Hi,

Basically I see two options:
1- Use application variables, with a Hashtable and the userID is the key.
2- Use a class with a static Hashtable or similar struct. it will be global
to the application therefore will not expire with the section.

Please note that both solutions assume that you are doing this for
registered users, if you allow anonymous users and treat each session as a
different user you have to do something else.

Cheers,

--
Ignacio Machin,
ignacio.machin AT dot.state.fl.us
Florida Department Of Transportation

"Bonj" <anonymous@.discussions.microsoft.com> wrote in message
news:B3D56FFC-CC10-495D-9C62-450DED7D33B2@.microsoft.com...
> I see Session variables time out after 20 minutes (or whatever number of
minutes you define).
> I want to have some variables that won't time out, but they only occupy
very small amounts of data, say 10-20 bytes per user, so I think it won't
too much of a performance impact to store it in the web server's memory.
Would having hash tables as global variables using the SessionID as key work
OK? Global variables and SessionIDs don't time out do they?
"Bonj" <anonymous@.discussions.microsoft.com> wrote in message news:B3D56FFC-CC10-495D-9C62-450DED7D33B2@.microsoft.com...
> I see Session variables time out after 20 minutes (or whatever number of minutes you define).
> I want to have some variables that won't time out, but they only occupy very small amounts of data, say 10-20 bytes per user, so I
think it won't too much of a performance impact to store it in the web server's memory. Would having hash tables as global variables
using the SessionID as key work OK? Global variables and SessionIDs don't time out do they?

It's not the session *variables* that time out, it's the *session* that will
be removed (along with all stored values) after the user has done
nothing (=no new page request) for 20 minutes.

How long do you want to keep this data? Could you store it in
a database?

Hans Kesting
All Session variables expires after 20 (or x minutes you choose) whatever
type they have, also the corresponding SessionID of the expired Session. Use
Application variables to store common variables.

--
Horatiu Ripa

"Bonj" <anonymous@.discussions.microsoft.com> wrote in message
news:B3D56FFC-CC10-495D-9C62-450DED7D33B2@.microsoft.com...
> I see Session variables time out after 20 minutes (or whatever number of
minutes you define).
> I want to have some variables that won't time out, but they only occupy
very small amounts of data, say 10-20 bytes per user, so I think it won't
too much of a performance impact to store it in the web server's memory.
Would having hash tables as global variables using the SessionID as key work
OK? Global variables and SessionIDs don't time out do they?
You could also look at storing this data in an encrypted cookie. Then you
can set the timeout to whatever you wish with no server overhead.
-mike
MVP

"Bonj" <anonymous@.discussions.microsoft.com> wrote in message
news:B3D56FFC-CC10-495D-9C62-450DED7D33B2@.microsoft.com...
>I see Session variables time out after 20 minutes (or whatever number of
>minutes you define).
> I want to have some variables that won't time out, but they only occupy
> very small amounts of data, say 10-20 bytes per user, so I think it won't
> too much of a performance impact to store it in the web server's memory.
> Would having hash tables as global variables using the SessionID as key
> work OK? Global variables and SessionIDs don't time out do they?

Session Variables

I have my session timeout at 20 minutes. Is there a way
to set session time per variable. For instance: I
create session("TEST") and I want it to expire in 2
minutes of no activity...Is that possible?

For Clarification:
If session time out in the web.config file is set to 20
minutes the session only times out if no activity occurs,
right!

ThanksNope. Just clear this variable when it is no more needed ? Use a timestamp ?

What is scenario ?

--

"brian" <bshannon@.lbrspec.com> a crit dans le message de
news:1b3d201c44fb8$dcb60670$a101280a@.phx.gbl...
> I have my session timeout at 20 minutes. Is there a way
> to set session time per variable. For instance: I
> create session("TEST") and I want it to expire in 2
> minutes of no activity...Is that possible?
> For Clarification:
> If session time out in the web.config file is set to 20
> minutes the session only times out if no activity occurs,
> right!
>
> Thanks
I think you can consider the use of Cache class
Page.Cache.Insert("KEY", value, null, DateTime.Now.AddMinutes(2),
TimeSpan.Zero);
will insert a value that will expire in 2 minutes without sliding
expiration.
See System.Web.Caching.Cache class for more information about this.

I hope this helps

brian wrote:
> I have my session timeout at 20 minutes. Is there a way
> to set session time per variable. For instance: I
> create session("TEST") and I want it to expire in 2
> minutes of no activity...Is that possible?
> For Clarification:
> If session time out in the web.config file is set to 20
> minutes the session only times out if no activity occurs,
> right!
Yes. If something happen the timeout is slided with another 20 minutes.

>
> Thanks
>

Session Variables

I have my session timeout at 20 minutes. Is there a way
to set session time per variable. For instance: I
create session("TEST") and I want it to expire in 2
minutes of no activity...Is that possible?
For Clarification:
If session time out in the web.config file is set to 20
minutes the session only times out if no activity occurs,
right!
ThanksNope. Just clear this variable when it is no more needed ? Use a timestamp ?
What is scenario ?
"brian" <bshannon@.lbrspec.com> a crit dans le message de
news:1b3d201c44fb8$dcb60670$a101280a@.phx
.gbl...
> I have my session timeout at 20 minutes. Is there a way
> to set session time per variable. For instance: I
> create session("TEST") and I want it to expire in 2
> minutes of no activity...Is that possible?
> For Clarification:
> If session time out in the web.config file is set to 20
> minutes the session only times out if no activity occurs,
> right!
>
> Thanks
>
I think you can consider the use of Cache class
Page.Cache.Insert("KEY", value, null, DateTime.Now.AddMinutes(2),
TimeSpan.Zero);
will insert a value that will expire in 2 minutes without sliding
expiration.
See System.Web.Caching.Cache class for more information about this.
I hope this helps
brian wrote:
> I have my session timeout at 20 minutes. Is there a way
> to set session time per variable. For instance: I
> create session("TEST") and I want it to expire in 2
> minutes of no activity...Is that possible?
> For Clarification:
> If session time out in the web.config file is set to 20
> minutes the session only times out if no activity occurs,
> right!
Yes. If something happen the timeout is slided with another 20 minutes.

>
> Thanks
>

Tuesday, March 13, 2012

Session Variables ~ Counting People On a Web site

Hi All,

I have two questeions:

I would like to try and count how many people are on a web site at one time.....

Can this be done in the global asax file with session variables ?

I have written an short statement below , will this work......?

Also when using session variables,, do I ned to destroy them on session finish? if so how would i do that....

rgs

Tony

<script runat="server"
Sub Application_Start(Sender As Object, E As EventArgs)

Application("HowMany") = Application("HowMany") +1

Application("AllowAdd") = True
Application("MaxTries") = 3

End Sub

Sub Application_End(Sender As Object, E As EventArgs)
' Code that runs on application shutdown
End Sub

Sub Application_Error(Sender As Object, E As EventArgs)
' Code that runs when an unhandled error occurs
End Sub

Sub Session_Start(Sender As Object, E As EventArgs)
Session("NumTries")=0
End Sub

Sub Session_End(Sender As Object, E As EventArgs)
' Code that runs when a session ends
End Sub

</scriptYou will need an application Variable..

Application("Hits") = 0;

tehn on Session Start you increase that variable:

Application("Hits") += 1;

Note: you might have to do some casting, I'm not sure how that is in VB.

HTH,
Covo
BTW, you can't use the session variables these variables expire with the session, the application variables only expire when the application is re-started.

If you want something more persistent, you will have to implement a method to store your hits in a database/file.

Covo
Hi,

I guess something like this:


if(Application["Count"] != null)
{
Application["Count"] = ConvertTo.Int32(Application["Count"]) + 1;
}

else
{ Application["Count"] = 1; }


Try something like this...


' when the application starts set the variable to 0
Sub Application_Start(Sender As Object, E As EventArgs)

Application("HowMany") = 0

End Sub

' when a new user visits the site, a new session opens... so, increment the variable
Sub Session_Start(Sender As Object, E As EventArgs)

Application("HowMany") = Application("HowMany") + 1

End Sub

' when their session expires, decrement the variable
Sub Session_End(Sender As Object, E As EventArgs)

Application("HowMany") = Application("HowMany") - 1

End Sub

session variables are lost when logged into app first time

Background
We migrated our Asp.net 1.1 application to Asp.net 2.0 ( just migration )
. It was working fine in local developer machine and one of our development
testing server.
When we moved to staging server which is also running on Windows 2000 server
and we started facing a peculiar issue.
We are able to login successfully every time , however , a click on a link
to move to a a different page on a hyper link.
<asp:HyperLink id="lnkClick" runat="server" ForeColor="Snow"
Font-Italic="True" Font-Size="Small"
Font-Underline="True" Font-Names="Arial" Target="_self"
Font-Bold="True">here</asp:HyperLink>
Code behind has the following code
lnkClick.NavigateUrl = Convert.ToString("Files12/Z_All_allReports.aspx")
What is the issue ?
When the new page is launched , it ends in null reference exception as the
session variables loaded in the previous page were lost.
Our session state is still inproc .
Is it due to any settings on the web server.
Any information is highly appreciated ."SM" <SM@.discussions.microsoft.com> wrote in message
news:A2CAF790-F6C1-4DF0-83E7-BA5975B6F979@.microsoft.com...
...
> Code behind has the following code
> lnkClick.NavigateUrl = Convert.ToString("Files12/Z_All_allReports.aspx")
Why do you need Convert.ToString?

> What is the issue ?
> When the new page is launched , it ends in null reference exception as the
> session variables loaded in the previous page were lost.
> Our session state is still inproc .
> Is it due to any settings on the web server.
I don't see any reason for your session state to be lost. Please show us why
you believe that your session state is being lost.
A simple test would be to place a Response.Write(Session["KEY"]) before the
place where you're getting the NullReferenceException. This would show
whether the exception is due to missing session state.
John

session variables are lost when logged into app first time

Background
We migrated our Asp.net 1.1 application to Asp.net 2.0 ( just migration )
.. It was working fine in local developer machine and one of our development
testing server.
When we moved to staging server which is also running on windows 2000 server
and we started facing a peculiar issue.
We are able to login successfully every time , however , a click on a link
to move to a a different page on a hyper link.

<asp:HyperLink id="lnkClick" runat="server" ForeColor="Snow"
Font-Italic="True" Font-Size="Small"
Font-Underline="True" Font-Names="Arial" Target="_self"
Font-Bold="True">here</asp:HyperLink>

Code behind has the following code
lnkClick.NavigateUrl = Convert.ToString("Files12/Z_All_allReports.aspx")

What is the issue ?
When the new page is launched , it ends in null reference exception as the
session variables loaded in the previous page were lost.

Our session state is still inproc .
Is it due to any settings on the web server.

Any information is highly appreciated ."SM" <SM@.discussions.microsoft.comwrote in message
news:A2CAF790-F6C1-4DF0-83E7-BA5975B6F979@.microsoft.com...
...

Quote:

Originally Posted by

Code behind has the following code
lnkClick.NavigateUrl = Convert.ToString("Files12/Z_All_allReports.aspx")


Why do you need Convert.ToString?

Quote:

Originally Posted by

>
What is the issue ?
When the new page is launched , it ends in null reference exception as the
session variables loaded in the previous page were lost.
>
Our session state is still inproc .
Is it due to any settings on the web server.


I don't see any reason for your session state to be lost. Please show us why
you believe that your session state is being lost.

A simple test would be to place a Response.Write(Session["KEY"]) before the
place where you're getting the NullReferenceException. This would show
whether the exception is due to missing session state.

John

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?

ThanksHey Randy,

"Randy" <temp@.temp.com> wrote in message
news:O54H7QbyFHA.736@.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...
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" <christoph.wienands@.siemens.remove.com> wrote in
message news:%235WsR4byFHA.3892@.TK2MSFTNGP12.phx.gbl...
> Hey Randy,
> "Randy" <temp@.temp.com> wrote in message
> news:O54H7QbyFHA.736@.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...
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" <christoph.wienands@.siemens.remove.com> wrote in
message news:%235WsR4byFHA.3892@.TK2MSFTNGP12.phx.gbl...
> Hey Randy,
> "Randy" <temp@.temp.com> wrote in message
> news:O54H7QbyFHA.736@.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...
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" <temp@.temp.com> wrote in message
news:ewp90QcyFHA.3588@.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" <christoph.wienands@.siemens.remove.com> wrote in
> message news:%235WsR4byFHA.3892@.TK2MSFTNGP12.phx.gbl...
>> Hey Randy,
>>
>> "Randy" <temp@.temp.com> wrote in message
>> news:O54H7QbyFHA.736@.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...
>>
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" <brubar_nospamplease_@.safeco.com> wrote in message
news:%23U9VDgcyFHA.3408@.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" <temp@.temp.com> wrote in message
> news:ewp90QcyFHA.3588@.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" <christoph.wienands@.siemens.remove.com> wrote in
>> message news:%235WsR4byFHA.3892@.TK2MSFTNGP12.phx.gbl...
>>> Hey Randy,
>>>
>>> "Randy" <temp@.temp.com> wrote in message
>>> news:O54H7QbyFHA.736@.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...
>>>
>>
>>
Do you have static variables ? They are shared by the whole application
(i.e. all sessions using *the* application).

--
Patrice

"Randy" <temp@.temp.com> a crit dans le message de
news:OzXN1rcyFHA.3000@.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" <brubar_nospamplease_@.safeco.com> wrote in message
> news:%23U9VDgcyFHA.3408@.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" <temp@.temp.com> wrote in message
> > news:ewp90QcyFHA.3588@.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" <christoph.wienands@.siemens.remove.com> wrote in
> >> message news:%235WsR4byFHA.3892@.TK2MSFTNGP12.phx.gbl...
> >>> Hey Randy,
> >>>
> >>> "Randy" <temp@.temp.com> wrote in message
> >>> news:O54H7QbyFHA.736@.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...
> >>>
> >>
> >>
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" <nobody@.nowhere.com> wrote in message
news:OYhp6%23cyFHA.3856@.tk2msftngp13.phx.gbl...
> Do you have static variables ? They are shared by the whole application
> (i.e. all sessions using *the* application).
> --
> Patrice
> "Randy" <temp@.temp.com> a crit dans le message de
> news:OzXN1rcyFHA.3000@.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" <brubar_nospamplease_@.safeco.com> wrote in message
>> news:%23U9VDgcyFHA.3408@.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" <temp@.temp.com> wrote in message
>> > news:ewp90QcyFHA.3588@.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" <christoph.wienands@.siemens.remove.com> wrote in
>> >> message news:%235WsR4byFHA.3892@.TK2MSFTNGP12.phx.gbl...
>> >>> Hey Randy,
>> >>>
>> >>> "Randy" <temp@.temp.com> wrote in message
>> >>> news:O54H7QbyFHA.736@.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...
>> >>>
>> >>
>> >>
>>>>
>>
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" <temp@.temp.com> a crit dans le message de
news:OrwZuIdyFHA.1168@.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" <nobody@.nowhere.com> wrote in message
> news:OYhp6%23cyFHA.3856@.tk2msftngp13.phx.gbl...
> > Do you have static variables ? They are shared by the whole application
> > (i.e. all sessions using *the* application).
> > --
> > Patrice
> > "Randy" <temp@.temp.com> a crit dans le message de
> > news:OzXN1rcyFHA.3000@.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" <brubar_nospamplease_@.safeco.com> wrote in message
> >> news:%23U9VDgcyFHA.3408@.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" <temp@.temp.com> wrote in message
> >> > news:ewp90QcyFHA.3588@.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" <christoph.wienands@.siemens.remove.com> wrote
in
> >> >> message news:%235WsR4byFHA.3892@.TK2MSFTNGP12.phx.gbl...
> >> >>> Hey Randy,
> >> >>>
> >> >>> "Randy" <temp@.temp.com> wrote in message
> >> >>> news:O54H7QbyFHA.736@.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...
> >> >>>
> >> >>
> >> >>
> >> >> >>
> >>
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" <nobody@.nowhere.com> wrote in message
news:OJInWYdyFHA.2644@.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" <temp@.temp.com> a crit dans le message de
> news:OrwZuIdyFHA.1168@.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" <nobody@.nowhere.com> wrote in message
>> news:OYhp6%23cyFHA.3856@.tk2msftngp13.phx.gbl...
>> > Do you have static variables ? They are shared by the whole application
>> > (i.e. all sessions using *the* application).
>>> > --
>> > Patrice
>>> > "Randy" <temp@.temp.com> a crit dans le message de
>> > news:OzXN1rcyFHA.3000@.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" <brubar_nospamplease_@.safeco.com> wrote in message
>> >> news:%23U9VDgcyFHA.3408@.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" <temp@.temp.com> wrote in message
>> >> > news:ewp90QcyFHA.3588@.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" <christoph.wienands@.siemens.remove.com> wrote
> in
>> >> >> message news:%235WsR4byFHA.3892@.TK2MSFTNGP12.phx.gbl...
>> >> >>> Hey Randy,
>> >> >>>
>> >> >>> "Randy" <temp@.temp.com> wrote in message
>> >> >>> news:O54H7QbyFHA.736@.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...
>> >> >>>
>> >> >>
>> >> >>
>> >>> >>> >>
>> >>
>>>>
>>