candland.code
Friday, October 27, 2006
« Using nant and tallow to create usable W...
|
Main
|
Setting build numbers with Nant »
Monorail: Exception Handlers: Flash and Redirect
While setting up exception chaining on monorail, I wanted to use the Flash properties to store the LastException for next request, an error page. This by default doesn't work if the exception happens outside of the Castle.MonoRail.Framework.MonoRailHttpHandler.Process method. This is because the Flash variables don't get saved until after this method. One note here, the Process method is wrapped in a try, finally block and the Flash properties will be saved in the case of an exception on the Process method, some additional checking in the exception handler may be needed to catch this. Anyway, I added the following line to my last handler and the Flash properties are working great.
context.Session[Flash.FlashKey] = context.Flash;
Secondly, I wanted to redirect to different views based on the exception, which I wasn't able to do. The reason was that the asp.net framework noticed the exception an handled according, not what I wanted. The way around this is to clear the error using the Server.ClearError() method before redirecting.
context.UnderlyingContext.Server.ClearError();
castle
Comments [0]
Related posts:
Warming up to MVC2, Castle, and Spark with Red Yawk
Resolve Lists and Arrays with Castle Windsor
Intercepting NHibernate to Handle Additional Database Work
NHibernate Session Per Request Using Castles WcfFacility
Unit Testing WCF Security with Castles WcfFacility
Setting Up AutoMapper For Use From A Container
Comments are closed.
Top Postings
Resolve Lists and Arrays with Castle Win...
Sum a column in a tab-delimited file usi...
Overriding NServiceBus Configuration
Castle monorail logging with windsor
Circuit City Sucks [rant]
Search
Tags
activerecord (2)
aimcc (3)
applications (2)
asp.net (8)
automapper (1)
AwsS3Library (3)
boo (3)
book (2)
brail (1)
build (5)
castle (27)
consulting (1)
csharp (40)
css (1)
dasBlog (3)
database (1)
facebook (1)
flash (1)
fluentnhibernate (2)
gnucash (1)
intermediate language (1)
javascript (8)
jquery (1)
Linq (2)
log4net (1)
monorail (12)
msbuild (2)
mvc (6)
n2cms (5)
nant (3)
nhibernate (11)
NS3Library (2)
nservicebus (4)
openid (1)
opensource (2)
powershell (8)
process (1)
prototype (5)
psake (5)
rant (1)
red27 (1)
redyawk (1)
review (2)
rhinomocks (3)
s#arp architecture (1)
sftp (1)
silverlight (1)
spark (3)
subversion (1)
teamcity (1)
testing (10)
tools (6)
visualstudio (4)
wcf (1)
webservices (4)
windows (4)
wix (3)
Links
Code Format
Amazon.com Widgets
About Me
I'm Dusty Candland a software developer in Colorado.
Email
Projects
Red27 Consulting
BambooTide
CloudSH.com
NS3Library