Jose Saiz

Jose Saiz

  • 1.1k
  • 260
  • 103.1k

Global.asax --> Application_BeginRequest

Apr 4 2018 4:52 PM
Hi, Guy I really need an expert opinion on this, I have tried all and the only thing that works for me is this
 
Global.asax 
  1. //-This works fine for now, the class(UserIsValidated) only fires while log-in,   when log-off or when downloading a .PDF file. 
  2. if (HttpContext.Current != null && HttpContext.Current.Items.Count>0)  
  3. {  
  4.     //- This is a class that validate authenticate user. 
  5.     if (!UserIsValidated)  
  6.     {  
  7.        //- Validate the user here, done validated do not fire anymore
  8.     }  
  9. }   
what I am trying to accomplish here is that when the user is authenticated that the class
UserIsValidated do not fire any more, as of now it is only firing when user is loging in for authentication, when the user is loging out of the application and when the user request a file for download. 
 
My question is, is there a better approach for the class {UserIsValidated} only firing when the user is authenticating his/her login access?
 
I do not like my application to have lots of working threads.
 
TIA
Jose