Thursday, May 27, 2004

Difference between Application Variables and Session Variables

-----Original Message-----
From: Vishal Joshi
Sent: Thursday, May 27, 2004 1:54 PM
To: Rakesh Ambudkar
Subject: RE: What does this mean

I presume that there are 2 types of variables in the discussion below:
Session
Application

Application variables are the variables which remain common for the whole application… Their value can be used across the whole application… And they die only when the application stops or probably when they are killed forcibily… The ideal example for these kindof variables are site counter… We can find out how many people accessed a particular site since the time it went live via application variables and incrementing the same on ever session start..
Session variables are variables which remain common for the whole application but for one particular user. They also can be used across the whole application… But they die when a particular user session ends or probably when they are killed forcibily… The ideal example for this kindof variable are user id… You might want to show "Welcome Vishal" on every page of your site till vishal logs off… So in session start you set a variable to "Welcome Vishal" and kill it on session end…
All these methods like session start, session end, application start, application end are found in global.asax and that’s the reason global.asax is one for the whole ASP.Net application…
I hope this provides you with the info that you needed…
Warm regards,
Vishal Joshi
Ph#: +1-309-763-2242.
If You Think YOU CAN.. You Can...

-----Original Message-----
From: Rakesh Ambudkar
Sent: Thursday, May 27, 2004 12:57 PM
To: Vishal Joshi
Subject: What does this mean


If you use objects with Application scope ,you should be aware that ASP.NET process request concurrently and the applicationobject can be accessed by multiple threads. Therefore following is dagerous and may not produce the desired result ,if the page is repeatedly requested by different clients at the same time.

Thanks
____________________________
Rakesh Ambudkar

29 comments:

Anonymous said...

thnx u reali helpd me.

Anonymous said...

Good and simple explanation.
Was really helpful!
Thanks

Anonymous said...

simple and clear.
thanks for your post

DIL said...

thanks friend. this really solved my problem.

best regards
Dilan Silva.

.Net(C#) said...

Hi frnds pratik here(C.E)..its really solve my prblm..thnx..if possible to send me interview question,,
my EmaId=pratik_jain1986@yahoo.com

Savvy said...

Hi Vishal,

The explanation abt Application variables and session variables has been precented in a really simple yet authentic way. Thanks for the same.

Savio Chacko

Anonymous said...

u made my task very simple..
thank u very much..

Anonymous said...

very nice work dude... you make the complicated thing very easy with nice example....

purpleriver-boy said...

Thank you....very nice explaination....helped me to understand asp .

Anonymous said...

Thank you it was great help

Anonymous said...

Awesome answer.Was searching for an exact one like this since long..Thanx dude.

Unknown said...

Hi Vishal,

The explanation abt Application variables and session variables has been precented in a really simple yet authentic way. Thanks for the same.

Vishal R Joshi said...

Thanks Gouse, I am glad it helped...

Prafulla said...

Thank you...You solved my problem which I faced in many Interviews...

Anonymous said...

thanx for the explaination wt example....

Anonymous said...

thanks a lot !!!
it cant be put in more simpler way
cheers !!

swathi said...

Thanks you , u totally cleared my confusion, simple super and easy to understand

Anonymous said...

thanx for ur post

Anonymous said...

Nice article...concept cleared related to session and application......

Anonymous said...

thanks a lot..for ur clear explaination

BIPIN KUMAR said...

Hi Vishal,
Thank you....very nice explaination

Anonymous said...

Hi Vishal,
Thank you....very nice explaination

Anonymous said...

Nice explanation With examples
Thank You.

Anonymous said...

thxs bro

Anonymous said...

Yeah, concise explanation with fitting examples. Thanks for helping me out!

Anonymous said...

Thanku ...:):)

Anonymous said...

nice examples

cIick IT said...

exactly

cIick IT said...

Thank you