Androme
Androme

Reputation: 2449

Global Variables in MVC best practice

What is the best practice with handling global, request in request, variables in ASP.NET MVC 3. What i need it for is configurations fetched from a database, that i want to make available throughout my MVC application, but the variables can change base on the request, so it need to be limited to the request scoop. The configurations variables are determent in a global action filter, so the way i handle it right now i simply to add the variables as request data, but i where hoping there is a better way to handle this.

Upvotes: 0

Views: 449

Answers (1)

Darin Dimitrov
Darin Dimitrov

Reputation: 1038710

You could use HttpContext.Items to store data that is available throughout the entire HTTP request.

Upvotes: 2

Related Questions