Is there a difference in handling between Session.Add("SOMETHING","somevalue") and Context.Items.Add("SOMETHING","somevalue")?

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

Be a part of the DaniWeb community

We're a friendly, industry-focused community of developers, IT pros, digital marketers, and technology enthusiasts meeting, networking, learning, and sharing knowledge.