I am using to Implement Custom membership provider and role provider for authinticating purpose in Asp.net MVC 4.
I followed this blog.
This app is very big app and very sensitive.I am not using builtin Authentication of MVC,I want to implement my own database schema.
I need to provide different privileges on different pages for same users. For example, The same user could be an administrator on one page and a guest on another,Some users may have read/write role while other have read only etc etc..For this purpose i need to keep user's information like username,userid,user_role & some other profile information and to check them on each click and each page on website.
My providers are working properly,I just have these questions.
What is the best way(in term of security & CPU processing) to keep these information with me & then check/compare them
- Keep in session and check everywhere?
- Keep in cookie and check everywhere?
- Do not need to save/keep,on page load get from db and decide on that time?
- Is there any other whay to do so?
- In MVC where do i need to have this check,either this user is authinticated to read this apage/section ot not?(In Index action of each Controller?)