开发者

Persistent Objects in ASP.NET

I'm trying to find the best way to persist an object or in use the same object at a later point in the code. So, I create an object, then you're redirected to another page(a form) that needs to use variables from that object. That form is submitted to a third party and there is stuff done on their end and then they request a page on my application that runs some more code and needs the objects variables again.

    开发者_运维技巧
  • I thought about Database but this is all done at once. This is done during a user checkout process and after it's over, there's no reason to retrieve this object again. So adding and retrieving from a database seems like it would be overkill and I think it would make the process slower.
  • Right now I'm using Session but I keep hearing not to use that but no one is really saying why I shouldn't except it is bad practice.
  • I can't really use post back values because the pages don't work that way. The checkout process starts off in a dll code that redirects to the form that is submitted to the third party and the a page is requested by the third party.
  • Started reading about Cache object but I haven't used this yet and I am not sure about it yet.

So, I'm not really sure of the best way. What are all the options and what does everyone recommend as the best way?


If you use Session, and the session expires, you lose the data. The user would have to start over. Also, all that data is hanging around until 20 minutes after the user leaves the page, by default

Persisting it in a database isn't bad, and the record can give you useful audit trail data later.

The cache object is a global cache, so its not specific to any particular user. Any user or page in the application domain can access that data. You could use the username to keep it, but I think the database is a better option

0

上一篇:

下一篇:

精彩评论

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

最新问答

问答排行榜