Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

.NET exceptions I can throw for Not Authorized or Not Authenticated

I have parts of code where I want to throw an Exception whenever a user is not authenticated/not authorized.

So instead of writing my own NotAuthenticatedException and NotAuthorizedException, I was wondering if there are not already some C# standards for these.

I can imagine a lot of programs throw similar Exceptions, and it would not be very useful if everyone 'writes their own wheel' again.

like image 786
Dirk Boer Avatar asked Mar 19 '13 09:03

Dirk Boer


1 Answers

You could also use UnauthorizedAccessException for authorization violations

like image 140
Gruff Bunny Avatar answered Oct 06 '22 01:10

Gruff Bunny