Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • SEARCH
  • Home
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 1103491
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 17, 20262026-05-17T01:21:02+00:00 2026-05-17T01:21:02+00:00

At a lot of places I have seen the following pattern. Consider the code:

  • 0

At a lot of places I have seen the following pattern. Consider the code:

Customer cust = (Customer) Session["Customer"]; 

//Do something to the object cust

Session["Customer"] = cust

and the code :

Customer cust = (Customer) Cache["Customer"];

//do something to object cust
Cache["Customer"] = cust;

Now, in the second case, putting the cust object back to Cache is not required as the reference is the same and any changes to the cust object shall be reflected in the cache.

But I dont think that is the case in case of Session, where the cust object has to be explicitly put back into the Session. However, I am not sure. Will the change reflect in Session if I do not explicitly specify the change as above?

And if it needs to be done explicitly, why the difference in behavior with Cache object? Both places we seem to be doing a reference passing.

This is for C#, ASP.NET

  • 1 1 Answer
  • 3 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-05-17T01:21:02+00:00Added an answer on May 17, 2026 at 1:21 am

    You do not have to explicitly reassign the object back to the Session. Any changes made on an object retrieved from Session will be reflected and persisted within the Session. Cache is different because it may expire. If you need any further assistance, let me know.

    One other thing, InProc Session is faster than Cache because Cache has to check expirations before returning the object.

    The object stored in Session and in Cache is just a pointer to the object, so any changes made to the object will be persisted WITHOUT the need to explicitly reassign the object back to the Session or Cache it came from.

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I know I've seen this done a lot in places, but I need something
I have read in a lot of places that assembly language is not usually
I have read in a lot of places to center elements (a div for
This code I am looking at has a lot of places where I see
I have searched a lot of places but couldnt find a clean sequential explanation
I have seen process.nextTick used in a few places and can't quite tell what
I have been working with webservices for over 2 years now. I have lot
In WPF and Silverlight, we have seen the following classes: UIElementCollection ItemCollection RowDefinitionCollection ColumnDefinitionCollection
I am new to AndEngine. I have seen use of PIXEL_TO_METER_RATIO in lot of
I have seen this kind of question a lot on the internet but it

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.