本文介绍了跨页面传递和使用数据的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我的网站上有一个部分,用户必须遵循以下三个步骤:

注册--->付款---->收据生成

每个部分都在不同的网页上.但是,它们都链接在一起.没有付款,注册将无法成功.在遇到这种情况之前,在注册页面之后,我将数据保存到数据库中,然后进入付款部分.但是,我意识到这可能会导致问题.如果用户突然关闭付款窗口,并且不保存付款,或者计算机关闭,则用户将在数据库中存储错误的信息.注册没有付款/收据.为了解决这个问题.我创建了一个类并从中创建了对象.我使用"PreviousPage"指令和类属性系统将每个对象传递给下一页.它工作正常,该对象将被读取并存储在一个新的类对象中,我将在其上写入更多数据并将其传递给下一页.然后在生成收据之前,我会将整个数据保存到数据库.但是,引起的问题是回发.如果发生回发,我将丢失所有对象的数据,并且由于回发而显然无法访问上一页,并且所有数据都将丢失.那我该怎么办呢?还有其他有效的方法吗?我不想使用会话,因为会话似乎过期和刷新太早.我试图更改会话超时属性,但似乎没有进行任何更改.所以我不想依赖会话,因为我负担不起丢失数据.我还有什么其他选择?我曾想在数据库中创建临时表,但认为这不是一个好方法. 解决方案


I have a section in my website where the user has to follow a three step process:

register ---> payment ----> receipt generation

each part is on a different webpage. However, they are all linked together. Without payment, a registration cannot be successful. Prior to my situation, after the register page, i was saving the data into the db and then proceeding to the payment section. However, i realized that this could lead to issues. if user suddenly closes the window at payment, and does not save the payment, or the computer shuts down, the user will have wrong info stored in the db. Registered without payments/receipt. In order to fight this issue. I created a class and created objects from it. I passed each object across to the next page using the "PreviousPage" directive and class property system. It worked fine, the object would be read and stored in a new class object and i would write more data on it and pass it on to the next page. Then before receipt generation, i would save entire data to the db. However, the problem being caused is Post back. If post back occurs, i loose all my objects data and cannot obviously access the previouspage as its a post back and all data is lost. So how do i go about this? is there any other efficient method? i do not want to use sessions as it seems the session is expiring and refreshing too soon. I tried to change the session timeout property but it doesn''t seem to make any changes. So i do not want to rely on session, as i cannot afford to loose the data. What other options do i have? I thought of creating temp tables in my db, but don''t think that would be a good method. Kindly advise!

解决方案


这篇关于跨页面传递和使用数据的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持!

10-21 11:07