Exception Handling declarative security

P

Patrick

I'm reading myself into security and ASP.Net.

I have written some demo code and now I'm wondering how you deal with
exception handling when you use declarative security

I have a method with the following attribute

[PrincipalPermissionAttribute(SecurityAction.Demand, Name="Patrick")]
private void MyFunction()
{
DoSomething().......
}

When I'm not athorized I will be redirected to a default errorpage.

My question is what is the best way to handle. 1)Redirect to a
customized errorpage or 2) is there a way to handle the exception so I
can raise a user friendly message to my frontend.

Thanks in advance

gr Patrick
 
C

Chris Rolon

You could subscribe to UnhandledException event handler on the current app
domain. In that way you could return a friendlier message.

Chris Rolon
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Members online

Forum statistics

Threads
473,734
Messages
2,569,441
Members
44,832
Latest member
GlennSmall

Latest Threads

Top