0

I am wondering and experimenting, can someone here can tell me how to pass a json from a controller action to another controller without using the session variable?? i am avoiding session because of confidentiality of data thanks.. Hope someone could help me

ECie
  • 1,265
  • 4
  • 21
  • 50
  • in the context of a single request? or is the 2nd controller supposed to get this json after a seperate request is made to the server? – Robert Levy Jun 06 '14 at 03:30
  • @RobertLevy to the 2nd controller. i want to retrieve the json from the first controller to the second one – ECie Jun 06 '14 at 03:32
  • You didn't actually answer my question – Robert Levy Jun 06 '14 at 11:40
  • at a second request, lets say that the first controller has a request to the server and it needs to pass the json to another one.. sorry if i dont get it – ECie Jun 09 '14 at 00:07

2 Answers2

1

Use return RedirectToAction() and pass the json as action method argument.

Duy
  • 1,332
  • 1
  • 10
  • 19
0

You can use TempData instead of the Session to persist data across a redirection.

Toan Nguyen
  • 11,263
  • 5
  • 43
  • 59
  • TempData is session, so it doesn't meet the question requirements. (http://stackoverflow.com/questions/1500402/when-to-use-tempdata-vs-session-in-asp-net-mvc) – Evonet Jun 06 '14 at 04:19
  • That's right, the data is persisted between requests but not shared! – Toan Nguyen Jun 06 '14 at 04:21
  • yeah tempdata is like a session.. it cannot contain data that are to be sensitive and it also adds amount in slowing the app(???) – ECie Jun 06 '14 at 05:37
  • i am trying to add to the request context so it cannot be seen on the browsers session storage. help please – ECie Jun 06 '14 at 05:40