tags:

views:

137

answers:

5

I have a search bar with 4 cascading dropdowns on it, the user makes a selection then clicks search. When the user returns to the search page I want the previous selected values to still be displayed.

Any comments on the best way to save these selected values?

+4  A: 

Any reason not to put them in the Querystring?

If you're thinking of session, try TempData first which will take care of disposing the session for you.

As mentioned elsewhere, cookies are okay, but not RESTful. With Querystring, a search can be bookmarked. Some notables use this approach (google and SO to name two)

dove
Querystring for the win - always use the querystring for a search. It's much more friendly.
sirrocco
+1  A: 

Use cookies, if a temporary save is okay for you.

brainfck
+1  A: 

Session is still available in ASP.NET MVC. Plus, its mockable now. Win-win.

Will
A: 

This is what the Session dictionary is for: store navigation values between page loads...

Palantir
A: 

We use enterprise library caching application block:

http://msdn.microsoft.com/en-us/library/dd203099.aspx

Shiraz Bhaiji
You use the caching block to store user data? I would understand using the caching block to cache say search results so repeated searches pull back the cached copy, are you really using it for user data also? If so how do you map the data instead from global to a user?
Chris Marisic
@Chris: Entlib is based on a key value pair. If you use the userid as a key then there is no problem to storing user data.
Shiraz Bhaiji