开发者

asp.net - undo delete session

I'm storing the orders in sessions and i give the possibilty to user to delete the order, but i'm trying to create an "undo" but i don't know how.

When the use开发者_JAVA技巧r ask to delete the session (the order), what you advice me to do to have the possibility to undo it? It don't need to be after X minutes, just in the same page so if he deletes the order, he see an option to undo the action.

Thanks


Store the deleted orders in a special "place" in the session, e.g:

Session["deleted_orders"] = new List<Order>();
...

Or add a Deleted flag to the order object.


Just add another key to the session [OrderDeleted] = true;


If your session state manager is kept in SQL this will be as simple as creating a copy of the session data into an "expired" table. If you keep session in memory, then on delete, create a copy of the session data in a SQL table somewhere along with a timestamp. This allows the record to be destroyed after it has grown moldy enough, but will live long enough that if the undo is clicked, the data you need can be restored.

0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜