Forum Moderators: open

Message Too Old, No Replies

Difference between Session variables and Context.Items

         

JohnBon

3:56 pm on May 21, 2003 (gmt 0)

10+ Year Member



Can someone tell me the differences/advantages/disadvantages between using Session variables versus the Context.Item method to pass data between pages?

Thanks

John

garann

5:01 pm on May 21, 2003 (gmt 0)

10+ Year Member



As I understand it, the Context object holds the references to your Request, Response, Session, etc. I think it's a container object meant more for the server's use than the programmer's. The Items property appears to carry data used by processes that you usually wouldn't interact with via the Context (maintaining the Session, checking whether users may access resources..). I've never tried using it to pass my own variables around, but it seems clear that's not what it's intended for.

The Session, Request, and Response, on the other hand, are intended for passing and maintaining custom data. If nothing else, there's an advantage to other people trying to understand your code in passing/storing your variables in the expected ways.

Hope that helps?
g.

JohnBon

1:48 pm on May 22, 2003 (gmt 0)

10+ Year Member



Thanks!

I have used them both and session variables seem to work much better..I was just wondering why?/

Thanks again!

John