Groups > Asp .Net > VS 2005 Web Application Projects > Re: Application Variable




Application Variable

Application Variable
Mon, 4 Feb 2008 21:45:27 +0000
I use the following code in my web application to grab the user name of the user
that is logged in. 

Application.Item("userName").ToString()

 

I also use the above code to run a SQL query that grabs some information from a
SQL DB based upon who is logged in. 

Something like:

"SELECT STUFF FROM MYTABLE WHERE USERNAME = ' " +
Application.Item("userName").ToString() " ' "

Now, all seems to be good and dandy until two users reportedly log in and around
precisely the same time. 

Then user A reportedly sees user B's stuff and vice versa. 

 Does this seem feasible and how do I adapt the application so that it won't
happen?
Post Reply
Re: Application Variable
Mon, 4 Feb 2008 22:02:36 +0000
You shouldn't be use the Applicaiton level for this... Session would be more
suitable as Application is shared within the Application (as the name
indicates). All users are hitting the same Application
Post Reply
about | contact