code_junkie

Custom authentication at the URL level, use ISAPI still with .NET or is there a new way

Nov 14th, 2011
61
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.56 KB | None | 0 0
  1. public class AuthModule : IHttpModule
  2. {
  3. public void Init(HttpApplication context)
  4. {
  5. context.AuthenticateRequest += OnAuthenticateRequest;
  6. context.AuthorizeRequest += OnAuthorizeRequest;
  7. }
  8.  
  9. private static void OnAuthenticateRequest(object sender, EventArgs e)
  10. {
  11. // authenticate the user here...
  12. // (note that the sender argument is an HttpApplication instance)
  13. }
  14.  
  15. private static void OnAuthorizeRequest(object sender, EventArgs e)
  16. {
  17. // ...then authorize their attempted action here, if needed
  18. }
  19. }
Add Comment
Please, Sign In to add comment