I currently have a custom attribute that is put on both my admin controller and home controller. The custom attribute will first go to active directory to check if the user is in a particular AD that gives them admin privilege to the whole application. If the user is not in the AD group the custom attribute will then look in the security table to see if they have a security record that can either give them admin rights, Add record rights, Delete record rights, and/or Update records rights.
I am setting up a current user during the execution of the attribute and adding it to the HttpContext.Current.Session. On the whole page loading I am making ajax calls to load data on each section of my page and the security can not be accessed in the ajax call. I want to hide and show the different buttons (Add, Remove, Edit and Delete) by the permission they have.
I have read I can use the attribute
[WebMethod(EnableSession = true)]
on my method which works but I do not think this is best practice and I know this slows down performance quite a bit. I also read this is used more for Web API not an MVC application. Is there a better way to access Session data in HttpContext during an ajax call?