Attach class to a Session in ASP.NET

    Date: 08/23/06 (C Sharp)    Keywords: asp, web

    Say, I have two classes:

    Buyer
    Seller

    Say, I also have a class

    User

    which can be either Buyer or Seller, or both, or anonymous. In fact, I want User to represent the current session, and have the following member variables:
    (i wrote self-explanatory members' names)

    User.the_page_Im_on_right_now

    User.the_page_I_wanned_to_visit_but_got_redirected_to_login

    User.class_seller_or_null_if_im_not_seller

    User.class_buyer_or_null_if_im_not_buyer

    As you see, the User class only makes sense to keep during a session. How can I connect this kind of class with a session, so that the object of the User class gets created when a user goes to the website, it disappears when user leaves; and it stays available as the user goes from page to page?

    Maybe there are built in functions for this whole thing, and I'm inventing a wheel?

    (I'm using ASP.NET 2.0 with C#)

    Source: http://community.livejournal.com/csharp/74435.html

« Static, and non-static... || Working with pieces of XML. »


antivirus | apache | asp | blogging | browser | bugtracking | cms | crm | css | database | ebay | ecommerce | google | hosting | html | java | jsp | linux | microsoft | mysql | offshore | offshoring | oscommerce | php | postgresql | programming | rss | security | seo | shopping | software | spam | spyware | sql | technology | templates | tracker | virus | web | xml | yahoo | home