Remove all elements of the application in ASP.Net.

Can anyone help me on this. I am using Asp.NET WITH C #. I have several products in my database. When I run my code, all product values ​​are stored in a database table. Without an exit button, if I close my application when I start the second time, the database table should be empty. I DO NOT USE! PAGE.ISPOSTBACK because I am adding different products in one go, which will be removed for single users. Can anyone tell me or show the code to remove items as the app is closed without an internal exit button event.

0


source to share


2 answers


If you are using a web application, there is no real way to detect when a user leaves your application. There are many strategies you can use, but none of them are 100% reliable. These strategies include:

  • User session timeout causes exit logic to execute (delete lines).
  • Using Javascript to detect when the user navigates away from the page and triggers an AJAX call for the logout logic.
  • Browser detection with Javascript and AJAX call like # 2.


You can change the logic here. Why not run some logic when the user logs in to detect these orphaned rows and remove them?

+1


source


You must add the cache item and call cache code using SlidingExpiration.

This way you can handle deleting all of your items when Expiration CallBack is triggered whenever users don't click the Logout button.



Check it out: http://geekswithblogs.net/jawad/archive/2005/05/23/CacheManager.aspx

0


source







All Articles