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:

  1. thnx u reali helpd me.

    ReplyDelete
  2. Good and simple explanation.
    Was really helpful!
    Thanks

    ReplyDelete
  3. simple and clear.
    thanks for your post

    ReplyDelete
  4. thanks friend. this really solved my problem.

    best regards
    Dilan Silva.

    ReplyDelete
  5. 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

    ReplyDelete
  6. 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

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

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

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

    ReplyDelete
  10. Thank you it was great help

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

    ReplyDelete
  12. Hi Vishal,

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

    ReplyDelete
  13. Thanks Gouse, I am glad it helped...

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

    ReplyDelete
  15. thanx for the explaination wt example....

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

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

    ReplyDelete
  18. thanx for ur post

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

    ReplyDelete
  20. thanks a lot..for ur clear explaination

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

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

    ReplyDelete
  23. Nice explanation With examples
    Thank You.

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

    ReplyDelete