views:

360

answers:

1

I have very simple:

[PrincipalPermission(SecurityAction.Demand, Role = "Administrator")]
public partial class _Default : System.Web.UI.Page

This works - it denies access if role is not administrator. But when it denies access, I simply get a white page (all unhandled exceptions are picked up in Global file and emailed/logged). How do I tell it where to direct on failure? So I can show a security exception page.

+1  A: 

In Global.asax.cs, add the following to Application_Error:

if (exception.GetType() == typeof(System.Security.SecurityException))
                Response.Redirect("SecurityExceptionPage.html");
Habaabiai
This ok with server side proccesing! but what about webmethod with ajax call? they not raise application_error...
ari