views:

49

answers:

1

I have social network website that contains thousands of users. Until now I used the classic way of storing user's details in the session object. Now, I want to upgrade it, so it will work against Memcached, and the key value is the "userId".

My question is: What is or where is the best place to keep the "userId" so I can use it constantly for querying the user's details from Memcached?

+1  A: 

Three options as I see it:

  1. Store it in the ViewState[] collection on your pages
  2. Store it in a cookie
  3. Store it in all urls

these can also be combined for added security/robustness.

Best practice imo would be to combine cookie with viewstate.

Mikael Svenson
Thx, I was hoping there is another solution...
jim77
Either your store it on the server or on the client, or both. What's wrong with adding it to the ViewState[]? Create a base page or HttpModule which handles setting the id.
Mikael Svenson