User Name Password Register
DaniWeb IT Discussion Community
All
What is DaniWeb IT Discussion Community?
You're currently browsing the ASP.NET section within the Web Development category of DaniWeb, a massive community of 426,486 software developers, web developers, Internet marketers, and tech gurus who are all enthusiastic about making contacts, networking, and learning from each other. In fact, there are 2,247 IT professionals currently interacting right now! Registration is free, only takes a minute and lets you enjoy all of the interactive features of the site.
Please support our ASP.NET advertiser: Lunarpages ASP Web Hosting
Views: 1411 | Replies: 1 | Solved
Reply
Join Date: Dec 2007
Posts: 287
Reputation: ericstenson is an unknown quantity at this point 
Rep Power: 1
Solved Threads: 28
Colleague
ericstenson's Avatar
ericstenson ericstenson is offline Offline
Posting Whiz in Training

Session.Add vs. Context.Items.Add

  #1  
Apr 7th, 2008
Is there a difference in handling between Session.Add("SOMETHING","somevalue") and Context.Items.Add("SOMETHING","somevalue")?
--
"Dummy."
AddThis Social Bookmark Button
Reply With Quote  
Join Date: Apr 2008
Posts: 1
Reputation: munr is an unknown quantity at this point 
Rep Power: 0
Solved Threads: 1
munr munr is offline Offline
Newbie Poster

Re: Session.Add vs. Context.Items.Add

  #2  
Apr 7th, 2008
Originally Posted by ericstenson View Post
Is there a difference in handling between Session.Add("SOMETHING","somevalue") and Context.Items.Add("SOMETHING","somevalue")?


Using Session.Add, the item will be added to the session and available throughout the duration of the session, across all pages.

With Context.Items.Add, the item will be added to the current page request only and accessible up until the page finishes loading, after which the value will be lost. In my experience, this is usually used in conjunction with Server.Transfer to pass values between pages.

Hope this helps.

Mun
Reply With Quote  
Reply

Only community members can participate in forum threads. You must register or log in to contribute.

DaniWeb ASP.NET Marketplace
Currently Active Users Viewing This Thread: 1 (0 members and 1 guests)

 

Thread Tools Display Modes

Similar Threads
Other Threads in the ASP.NET Forum

All times are GMT -4. The time now is 4:47 pm.
Forum system based on vBulletin Copyright ©2000 - 2008, Jelsoft Enterprises Ltd.
©2003 - 2008 DaniWeb® LLC