Click here to Skip to main content
15,886,519 members
Please Sign up or sign in to vote.
0.00/5 (No votes)
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

1 solution

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...
 
Share this answer
 
Comments
Member 9359591 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ő 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 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)



CodeProject, 20 Bay Street, 11th Floor Toronto, Ontario, Canada M5J 2N8 +1 (416) 849-8900