TheRealDanBiss
TheRealDanBiss

Reputation: 254

asp.net check cookie against database on each page request

I'm storing a cookie that will check against a database to grant access to a site. All session info will be stored in the database. How do I make a call to the database on every page request to get session info? Is there a controller that I can run on every page?

Upvotes: 1

Views: 483

Answers (1)

Shashank Chaturvedi
Shashank Chaturvedi

Reputation: 2793

You can actually create an Action filter for your controller. In that filter you override OnActionExecuting method and inside that method you can fill in your session values. Here is a link, where you can find a sample code for creating Action filters.

Upvotes: 1

Related Questions