简体   繁体   English

ASP.NET,关闭浏览器窗口

[英]ASP.NET, closing browser window

Suppose I have an ASP.NET registration wizard. 假设我有一个ASP.NET注册向导。 The collected information for each step is temporary stored in a database table, when clicking “Next”. 单击“下一步”时,每个步骤的收集信息将临时存储在数据库表中。 Now suppose the user closed the browser window, or computer was unexpectedly shut down. 现在假设用户关闭了浏览器窗口,或者计算机意外关闭。 So in that the application should delete all the temporary registration information. 因此,应用程序应删除所有临时注册信息。 How could it be done? 怎么可能呢?

Additional information: I cannot use cannot use a Session object because the application is served from a webfarm. 附加信息:我不能使用不能使用Session对象,因为该应用程序是从webfarm提供的。

I thought already about using a stored procedure for clean up the table. 我已经考虑过使用存储过程来清理表。 But want to find out other possibilities. 但是想找出其他可能性。

Simply do not store into db data that is incomplete. 只是不要存储到不完整的db数据中。 Use a session as a temporary storage instead. 而是将会话用作临时存储。 It gives you not only a better performance (you avoid db hits), but it avoids problems like yours altogether. 它不仅为您提供了更好的性能(您可以避免db命中),而且可以避免像您这样的问题。 Store to database only after all necessary info has been inputted. 只有在输入所有必要信息后才能存储到数据库。

In such scenario, you can assign a temporary registration id for each session/attempt. 在这种情况下,您可以为每个会话/尝试分配临时注册ID。 If the window is closed, next attempt will be a new one and the application should run a clean up job every night or so to delete incomplete attempts. 如果窗口关闭,则下一次尝试将是新的,应用程序应每晚运行清理工作,以删除不完整的尝试。

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM