views:

28

answers:

1

I'm fetching some settings out of the database based on a value passed from a query string. Out of these settings, a few will be used in master page, few on my Page and few in my user control (say login control which is a web user control). I've an entity class MySetting for it and there is a method in my data access layer which returns me an instance of MySetting when I pass the value I got in query string.

I don't want to fetch settings from the database multiple times for one request. I'm using asp.net web forms with C# and sql server.

+2  A: 

Is only an idea, but you can put in on Context (System.Web.HttpContext.Current) collection, it will be available on Master, page and control and it will exist all the request.

But if the data must be available on more than only one request I use session instead.

Elph
I'm not able to access Request.Context collection in my aspx.cs code behind file. Is it in VB.NET or C#
Ismail
Sorry, is not Request.Context, you can use Context (just like Session) or System.Web.HttpContext.Current
Elph
May be you can edit the answer to correct it. Anyways thank you very very much. :)
Ismail
you're rigth. Answer edited.
Elph