O'Reilly logo

ASP.NET MVC 2 Cookbook by Richard Kimber, Andrew Siemer

Stay ahead with the world's most comprehensive technology and business learning platform.

With Safari, you learn the way you learn best. Get unlimited access to videos, live online training, learning paths, books, tutorials, and more.

Start Free Trial

No credit card required

Maintaining a user's information while at your site

This recipe is all about keeping track of a user's information while on your site. Generally, once you have identified a user on your site, there will be bits of information that you will need with almost every request that the user makes. This type of information is usually best stored in a session (either on the server they are on, or in some external state server). In this recipe, we will take a look at how we can create a wrapper for the session and get strongly typed objects out of it easily. This will allow us to interact with the objects stored in our session in a very easy fashion.

How to do it...

  1. Start by creating a new default ASP.NET MVC 2 application.
  2. We will create an Account class ...

With Safari, you learn the way you learn best. Get unlimited access to videos, live online training, learning paths, books, interactive tutorials, and more.

Start Free Trial

No credit card required