Click here to Skip to main content
Rate this: bad
good
Please Sign up or sign in to vote.
i have a search request on a view with a find button. when the button clicked i have its response in Json, and a submit button on the same view.So the search request its json response and a submit on the same view,now when i click the submit button it goes to another view of different controller,and in that view i have a back button which has to come back to my search page, where it should show the search and the json response. For this i need to store the search request and the json response coming..i have the json response in javascripts. So how do i store the search request and the json response in-order to show the request and response when i click the back button. using MVC3 razor
Posted 15-Oct-12 7:47am

1 solution

Rate this: bad
good
Please Sign up or sign in to vote.

Solution 1

You are perfectly right in your question title: session is one option, cookie is an other. But it depends on what you have done with your "json response". Let's suppose it is a simple text value.
When handle the search ajax action, store the result in the session. When you render that view, use the session value to restore the result. With cookie you do quite the same, just with javascript and on client side.
If the result is more complex, you have to decide how to store it efficiently...
  Permalink  
Comments
Member 9359591 at 15-Oct-12 13:31pm
   
actually i'm new to this and i dont know how to store the session. can i know whats the code to store that session
Zoltán Zörgő at 15-Oct-12 13:49pm
   
It is quite the same, as with asp.net classic. See: http://msdn.microsoft.com/en-us/library/system.web.httpcontext.session(v=vs.80).aspx
Member 9359591 at 16-Oct-12 14:00pm
   
thank you Zoltan Zorgo

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)

  Print Answers RSS
0 OriginalGriff 295
1 DamithSL 265
2 CPallini 235
3 Maciej Los 190
4 George Jonsson 170
0 OriginalGriff 5,415
1 DamithSL 4,422
2 Maciej Los 3,820
3 Kornfeld Eliyahu Peter 3,470
4 Sergey Alexandrovich Kryukov 2,911


Advertise | Privacy | Mobile
Web04 | 2.8.141216.1 | Last Updated 15 Oct 2012
Copyright © CodeProject, 1999-2014
All Rights Reserved. Terms of Service
Layout: fixed | fluid

CodeProject, 503-250 Ferrand Drive Toronto Ontario, M3C 3G8 Canada +1 416-849-8900 x 100