View Full Version : DataModel doesn't work with Transfer
jberkovitch
01-26-2006, 12:17 PM
I found out that DataModel doesn't work, when I use the transfer mode for my pages. In this case the data has not been saved. Only if I use the redirect mode, the data which I marked as DataModel is saved for this page. Can someone tell, why?
Aleks Seovic
02-21-2006, 05:33 AM
Sorry it took so long, I just started going through the list of posts to close all of the minor issues up and realized I never responded to this post.
The reason is that Transfer method, as I believe you pointed out in another post, throws ThreadAbortException, so the code that should execute after it, including the code that saves the data model, never gets executed.
- Aleks
angryrobot
03-28-2006, 02:55 PM
Aleks,
Is this possible to fix, or not, due to the .NET design? Transfer is preferable to redirect for all the reasons outlined in your docs, but not if DataModel can't work when you SetResult() in an event handler. I would think this is a common way to use both features.
-Dave
Aleks Seovic
03-31-2006, 05:30 AM
Hi Dave,
As Microsoft would say "it's not a bug, it's a feature" ;)
Personally, I think that using exceptions to control application flow is a code smell, but in this case there is nothing we can do to fix the problem as ASP.NET relies on that ThreadAbortException being thrown.
That said, the whole discussion is quickly becoming irrelevant, as 1.1 P3 will not have DataModel attribute, which is gonna be replaced with a much better state management mechanism that won't suffer from this problem.
Regards,
Aleks
angryrobot
03-31-2006, 12:55 PM
Aleks,
That's great...thanks. I can't wait to see it all come together!
-Dave
Powered by vBulletin® Version 4.2.0 Copyright © 2013 vBulletin Solutions, Inc. All rights reserved.