asp.net - Best Practices when using .NET Session for temporary storage? -


i'm still relatively new .net , asp.net mvc, , have had few occasions nice store information retrieved db temporarily can used on subsequent server request client. have begun using .net session store information, keyed off of timestamp, , retrieve information using timestamp when hit server again.

so basic use case:

  1. user clicks 'query' button gather information system.
  2. in js, generate timestamp of current time, , pass server request
  3. on server, gather information db
  4. on server, use unique timestamp client key session store response object.
  5. return response object client
  6. user clicks 'generate report' button (will format query results excel doc)
  7. pass same timestamp #2 down server again, , use gather query results #4.
  8. generate report w/o additional db hit.

this scheme have begun use in case use session temporary storage. generating timestamp in js isn't secure, , whole things feels little... unstructured. there existing design pattern can use this, or more streamlined/secure approach? appreciated.

thanks.

you may take @ tempdata stores data in session.when pull out of tempdata removed after action done executing.

so, if put in tempdata in action, live in tempdata across other actions until requested tempdatafrom tempdata again.

you can call tempdata.peek("key") keep in memory until call tempdata["key"] or tempdata.remove("key")


Comments

Popular posts from this blog

linux - Using a Cron Job to check if my mod_wsgi / apache server is running and restart -

actionscript 3 - TweenLite does not work with object -

jQuery Ajax Render Fragments OR Whole Page -