简体   繁体   中英

ASP.net web application data integrity issue

Let say...

If we ASP.net banking application. When user press a button then it will debit $100 from his account.

Issue: What happened if user two or three times click on this button without waiting for first inform or it press F5/refresh page.

How we can prevent or get data integrity.

如果您使用任何ASP.Net Ajax, 回发Ritalin将有助于防止多次回发。

The easiest way to prevent users from submitting the same form multiple times is to simply disable the button, posting your form back. That way they can't accidentaly re-submit it before the page gets processed.

Also, passing through a random piece of string alongside with the other form variables can help you as well. In that case you could compare the string (alongside with other information) to see if previously you've processed a request that had matching details.

Am guessing/hoping this is an exam question of some kind? Anyways, here a couple of pointers;

look into transactions (for the sum to add up) and perhaps optimistic concurrency (to avoid changing what have been updated by others)

good luck!

BR

Daniel

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

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