1

I am using the standard session in asp .net to store some user variables. My problem is that in the code I change some fields in the variables that I fetch from the session. So my question is, what should I do? How should I handle the variables to be sure that the latest changed version is always stored in the session. Is there some kind of mechanism to do this?

1
  • Add some code to get better answer Commented Jun 8, 2014 at 16:48

1 Answer 1

1

You should wrap your session value in a property then read and write only that property

public string MyVal{
  get{
   return Session["myVal"];
  }
  set{
   Session["myVal"]= value;
  }

}
Sign up to request clarification or add additional context in comments.

Comments

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.