I’m working on a web-application. I’m getting data from the DB, doing some computations and drawing a graph. This app is based on MVC 4, is written in C#/Razor and uses jQuery plugins.
I’m wondering if it is worthwhile to use a session for only one variable. The app is open and the variable has nothing to do with login. It is just an ID, which is constant for this app and I need it constantly. Or should I better put it in query string?
If that ID is going to be same for all the user then its better if you use Cache, but if you have a separate ID for each user then you can store it in Session, rather than using querystring. It may difficult to manage query string with your application evolving over time.
You should worry about storing large dataset in a session, since sessions are maintained on the server, for a simple ID, session is probably the best storage mechanism (IMO)