I am using asp.net 3.5 web.config to limit access and it works great.
Not having tested this in other scenarios, but looking at some of the suggestions from this detailed article for a similar problem.
The other problem turned out to be:
the access to the error page was blocked by the authorization requirements.
The solution was to use a attribute in the web.config. refer to the link for more detailed explanation but here's a snippet: