views:

108

answers:

1

Hi guys,

I'm trying to get the HandleError attribute to work, but I'm having some difficulty because of a sort of a special circumstance.

I have another attribute which checks against a blacklist of IPs in my database and quite literally throws an exception. I was hoping to catch that exception with the HandleError attribute and route to the Error page, but it's not working.

I thought that the order of operations might be what I need, but it doesn't seem to work either... I tried:

[Custom(Order = 1), HandleError(Order = 2)]
Controller...

And:

[HandleError(Order = 1), Custom(Order = 2)]
Controller...

Neither seem to catch the exception. If anyone has any suggestions, I would appreciate them, thanks in advance!

+1  A: 

Okay, so I figured it out. In the webconfig you need to have the "customerErrors" property set or it won't work at all. In the end I guess I should have spent some more time working on it before posting...

Alex