kamagra how much to take

Please Customize Authentication Exceptions

Exception handling does not always imply good exception handling. For unauthorized access errors (a.k.a a 401 error) in your SharePoint WebParts you should really take advantage of the fact that C# allows you the option to define user-defined exceptions that inherit from one of the standard exception classes. You will be happier when you are getting access denied errors when doing resolution against System.Security.Principal.WindowsIdentity, and it is just a better practice.

Here is a class file that you can use as a base, extend it, go nuts with, it obviously is nothing but a skelton class that is meant to be used for demonstration purposes. The reason that it inherits from the ApplicationException base class as opposed to the exception base class is that ApplicationException is thrown from the WebPart (because it is for the applicaiton itself) as opposed to the Commen Language Runtime (since I am not interested in system errors), you would be creating your own exceptions so ApplicationException makes sense to use.

  1. using System;
  2.  
  3. namespace arb.Generic.Library.ExceptionHandling
  4. {
  5. internal class AccessDeniedException : ApplicationException
  6. {
  7. internal AccessDeniedException()
  8. {
  9. }
  10.  
  11. internal AccessDeniedException(string message) : base(message)
  12. {
  13. }
  14.  
  15. internal AccessDeniedException(string message, Exception inner) : base(message, inner)
  16. {
  17. }
  18.  
  19. }
  20. }
Share

Leave a Reply

Your email address will not be published. Required fields are marked *

You may use these HTML tags and attributes: <a href="" title=""> <abbr title=""> <acronym title=""> <b> <blockquote cite=""> <cite> <code> <del datetime=""> <em> <i> <q cite=""> <s> <strike> <strong>