/?pid=1575

Updated:12:54 PM EST Dec 22


this is ggmania.com subsite Concurrency Issue with ASP.NET 2.0 - TechAmok

Concurrency Issue with ASP.NET 2.0 - [briefly]
02:00 PM EDT - Oct,07 2006 - post a comment

ScottOnWritting.net reports that there is a potentially severe concurrency issue with ASP.NET 2.0 GridViews, DetailsView, or FormViews that support editing and/or deleting and whose view state is disabled.
PROBLEM: Two users - Alice and Bob - visit a page (Products.aspx) that uses a GridView whose to list products; the GridView's view state has been disabled. The GridView uses its DataKeys collection to store the primary key values of the three products. Imagine that the products listed are Pens, Books, and Paper, and their respective primary key values are 1, 2, and 3.

1) Alice clicks on the Delete button for the first product in the grid (Pens).
2_ A postback occurs. Because the GridView's view state has been disabled, on postback the data is re-read from the GridView's data source. This has the side effect of repopulating the DataKeys collection with the newly read data!
3) Since the first row index was clicked, the GridView grabs the DataKeys value indexed at 0 and issues a delete based on that primary key value (1).
4) Bob still sees all three products on the page (since he loaded the page before Alice deleted Pens). Sometime after Alice has made her deletion, Bob, too, decides that Pens must be deleted. He clicks on the Delete button for Pens.
5) A postback occurs. Because the GridView's view state has been disabled, on postback the data is re-read from the GridView's data source. This has the side effect of repopulating the DataKeys collection with the newly read data!
6) Since the first row index was clicked, the GridView grabs the DataKeys value indexed at 0. However, since the DataKeys collection has been reloaded in Step 5, the first DataKeys value is the primary key of Books (since Pens has since been deleted). The consequence is that Books is deleted, even though Bob wanted to delete Pens!!

More generally, if Alice deletes any product whose index preceeds the index of the record Bob deletes, Bob's delete will actually delete a different record. Similarly, if Alice deletes a preceeding record of the one Bob is editing, the edits will be applied to a preceeding row. Eep.


Add your comment (free registrationrequired)

Short overview of recent news articles

Dec,22 2025 NVIDIA Killing Cheap 16GB Local AI GPUs?
Dec,21 2025 Top 10 Movie Sequels of All Time
Dec,21 2025 He Built a Privacy Tool. Now He's Going to Prison (Kone Rodriguez,
Dec,20 2025 Insane Moves! B-Boy Shigekix vs. B-Boy Issin - Red Bull BC One World
Dec,20 2025 9800X3D & RTX 5070 Ti Gaming PC - MSI Project Zero Done Right
Dec,19 2025 The XG27AQWMG Sets a New Standard for 1440p OLED
Dec,19 2025 OnePlus 15R Boasts Huge 7,400 mAh Battery
Dec,19 2025 Motorola Refreshes moto g power for 2026
Dec,18 2025 NVIDIA GeForce 591.59 WHQL Driver
Dec,18 2025 Are We Quitting YouTube Due To DRAM Apocalypse?
Dec,16 2025 The Samsung TriFold is AWESOME!
Dec,16 2025 $30 vs $30,000 TV
Dec,16 2025 Stranger Things 5 - Volume 2 Trailer
Dec,14 2025 Google Brings Live Video Sharing to 911 Calls on Android
Dec,14 2025 Samsung One UI 8.5 Will Offer New Features
Dec,14 2025 Dell AW3225QF Review - 32-inch curved gaming monitor
Dec,13 2025 HW News - AMD Says AI Definitely, Absolutely Not A Bubble, New
Dec,13 2025 The BEST Smartphones of 2025!
Dec,11 2025 10 Atmospheric Games That Might CHANGE YOUR LIFE
Dec,11 2025 Samsung Galaxy S26 Ultra - Samsung Isn't Hiding It Anymore
Dec,10 2025 AMD Releases Adrenalin Edition 25.12.1 WHQL Drivers
Dec,10 2025 S25 Ultra VS 17 Pro Max
Dec,09 2025 All You Need Is Kill - Official Trailer
Dec,09 2025 Why can’t you be NORMAL?!? Roasting Staff Setups
Dec,09 2025 A Ryzen Cooling MONSTER - be quiet Silent Loop 3 Review
Dec,07 2025 The Boys - Official Final Season Trailer
Dec,06 2025 Unemployed in your 30's
Dec,05 2025 Play Store Customers to Receive Automatic Payments from $700 Million
Dec,05 2025 Google's Second Release of Android 16 Brings Smart Notifications
Dec,05 2025 Netflix To Buy Warner Bros for $82.7 Billion
Dec,03 2025 Micron to Exit Crucial Consumer Business, Ending Retail SSD and DRAM
Dec,02 2025 Samsung Galaxy Z TriFold Unboxing!
Nov,30 2025 Top 5 Best CPUs of 2025
Nov,30 2025 Google Adding AirDrop to Android
Nov,29 2025 20 TOP ALIEXPRESS products for BLACK FRIDAY
Nov,26 2025 Stop Wasting Money on Premium Monitors
Nov,23 2025 The Blackest Friday - Tech News Nov 23
Nov,23 2025 T-Roc: Will this new VW be the best car of 2026?
Nov,23 2025 Can I build my own Steam Machine?
Nov,22 2025 50 NEXT-LEVEL Gadgets Every Man NEEDS to See
>> News Archive <<

TechAmok - Privacy Policy        loading time:0.01secs