HttpContext.Items - Only lasts until the request has ended and the page is sent to the user. Use it wherever you have a bit of data that you want to cache, but get rid of when the page is done processing.
Session - Secure info that never leaves the server and exists for the length of a user's session. Use it for large amounts of data that you must store or things you don't want the user to have access to. Be warned that if you have a larger application, storing a lot of items in session can eat up the server's memory.
Cookies - Can be per session or until you set the cookie to expire or the user/browser deletes them. There's a 4k size limit and you're limited to so many cookies per domain so keep the amount of information small and be aware that the cookies are sent from the browser with every request whether you use them or not. Use it for small amounts of data that will either keep the server memory from being taxed or be persisted long-term.
This site uses cookies to help personalise content, tailor your experience and to keep you logged in if you register.
By continuing to use this site, you are consenting to our use of cookies.