views:

72

answers:

2

Hi,

I've implemented a catch all security exceptions method in my global.asax like this...

protected void Application_Error(object sender, EventArgs e)
 {

  Exception err = Server.GetLastError();
  if (err is System.Security.SecurityException)
   Response.Redirect("~/Error/Roles.aspx);

 }

Is there a property I can access that shows the name of the role which was missing from the users permissions? Ie. err.RoleThatFailed?

Manh thanks,

ETFairfax.

A: 

You can just output the whole stacktrace.

i.e.,

err.ToString() will tell you more info.

Ngu Soon Hui
Thanks for the reply. I wanted to be more specific on the page that the users see. I.E "You do not have permission XYZ".err.ToString() is going to my error log so I can see what happened, but the user needs to see something a bit friendlier!
ETFairfax
A: 

Anyone else got anything to say on this subject?

ETFairfax