D
David Krussow
Before refactoring my code, just wanted to get your opinion. My objective is
to allow users to open a page, make some changes, and then possibly hours
later post back to the server so their changes can get saved to a SQL Server
database. Sessions necessarily time out, and are therefore not a good option
for storing data required on postback. Please check my reasoning on getting
away from storing things in the Session.
In the current version (the one I'm getting away from), when the user
requests an ASPX page a few variables (int and string values) and relatively
small DataSet are stored in the Session. On postback the code reads or
updates the variables and/or DataSet, then updates a SQL Server database.
One of my concerns about this arrangement is that the Session may time-out -
thereby destroying the variables and DataSet, in which case the postback
logic would fail.
I'm thinking that it might be better to never store the variables and
DataSet in the Session and instead (1) store the variable values in the
ViewState and (2) rebuild the DataSet whenever it's needed by the PostBack
logic. While this would create more round-trip data (larger viewState) and
incur an additional hit on the database, I'd at least meet my objective of
enabling the user's changes to get saved on postback - even in cases where
the postback occurs a long time after the Session has timed-out.
Thoughts, opionions, suggestions, alternatives?
Thanks in advance!
to allow users to open a page, make some changes, and then possibly hours
later post back to the server so their changes can get saved to a SQL Server
database. Sessions necessarily time out, and are therefore not a good option
for storing data required on postback. Please check my reasoning on getting
away from storing things in the Session.
In the current version (the one I'm getting away from), when the user
requests an ASPX page a few variables (int and string values) and relatively
small DataSet are stored in the Session. On postback the code reads or
updates the variables and/or DataSet, then updates a SQL Server database.
One of my concerns about this arrangement is that the Session may time-out -
thereby destroying the variables and DataSet, in which case the postback
logic would fail.
I'm thinking that it might be better to never store the variables and
DataSet in the Session and instead (1) store the variable values in the
ViewState and (2) rebuild the DataSet whenever it's needed by the PostBack
logic. While this would create more round-trip data (larger viewState) and
incur an additional hit on the database, I'd at least meet my objective of
enabling the user's changes to get saved on postback - even in cases where
the postback occurs a long time after the Session has timed-out.
Thoughts, opionions, suggestions, alternatives?
Thanks in advance!