I need to store a site ID.
Currently I store the ID in a file on the site folder and cache the ID once the site is first accessed. For reasons I don’t want to get into right now, I can no longer use this option.
I need to store the Id another way. I’m thinking either store it in a cookie or save to the session state. I need to know which will be most efficicent.
CPU and memory is a big issue for the machine I’m running this on.
Is it better to read it off the clients machine for the ID? Or store it in a session variable?
Session state consumes either RAM or database resources, depending on which provider you use (InProc vs. SQL). It also requires a cookie, in order for the server to associate an incoming request with a particular Session collection.
For something like a site ID, I would suggest storing it in a cookie if you can. For best performance, configure the cookie with a path property so the browser doesn’t include it with requests for images and other static files.