views:

214

answers:

1

I want to redirect the user to a custom error page when s/he is denied access to a page because of ASP.NET Membership's Roles. I thought this could be solved by the customErrors section of the web.config file, but none of the errors I've tried has caught it.

In other words, if a user is in the role "Project Focal" access, and tries to access a page that is authorized only for users in the role "Administrator", I want ASP.NET to redirect this user to a special page where I can record the error and help the user.

This sounds like a simple requirement, but none of my googling has found an answer. Any help would be greatly appreciated.

+1  A: 

Your answer lies here

It has a good explanation as well as why you have to use Application_EndRequest in this case.

RandomNoob