Velocity Reviews - Computer Hardware Reviews

Velocity Reviews > Newsgroups > Programming > ASP .Net > ASP General > Is this normal methodology?

Reply
Thread Tools

Is this normal methodology?

 
 
Tapplication@gmail.com
Guest
Posts: n/a
 
      12-30-2005
I do not consider myself a ASP expert by any means so I must ask this
question to see if this is normal or if there is a better way.

I have a web site that I have developed that uses a lot of DB lookups
for Comboboxes and sections, as well as other configs- All in a
database.

Instead of having this done on EVERY page via direct DB lookups.... We
are talking lots of SQL lookups for every page.

What I want to do is have an included page say SiteHeader.ASPX and do
the following

If Not Application("Initialized") then
InitializeMyApplication()


InitializeMyApplication() Will Do all the database Lookups and create
dropdowns dyanmicly and assign it to a string -- say S,

Application("SiteDropDownList5") = S
Application("Initialized") = True


Then just used this dynamically generated HTML on my pages.


Please Select: <%=Application("SiteDropDownList4")%>


Is this normal?

 
Reply With Quote
 
 
 
 
Dale
Guest
Posts: n/a
 
      12-30-2005
What you propse would certainly work, but why not use the built-in caching
capabilities of ASP.Net?

I typically let my data handler manage the caching. When a method requests,
let's say dsAccountingCodes, for populating a dropdown list, the data handler
checks the cache for a value such as Cache["AccountingCodes"]. If
Cache["AccountingCodes"] is null then the data handler goes to the database,
retrieves the accounting codes list and returns the retrieved list after
storing it for the next request in cache using Cache.Insert.

I usually expire my cached objects in 15 to 30 minutes depending on the
application. You can use timed or other cache dependencies outlined on MSDN.

The next request for the same data will come from cache with no call to the
database.

Here's a place to start:

http://msdn.microsoft.com/library/de...nCacheAPIs.asp

--
Dale Preston
MCAD C#
MCSE, MCDBA


"" wrote:

> I do not consider myself a ASP expert by any means so I must ask this
> question to see if this is normal or if there is a better way.
>
> I have a web site that I have developed that uses a lot of DB lookups
> for Comboboxes and sections, as well as other configs- All in a
> database.
>
> Instead of having this done on EVERY page via direct DB lookups.... We
> are talking lots of SQL lookups for every page.
>
> What I want to do is have an included page say SiteHeader.ASPX and do
> the following
>
> If Not Application("Initialized") then
> InitializeMyApplication()
>
>
> InitializeMyApplication() Will Do all the database Lookups and create
> dropdowns dyanmicly and assign it to a string -- say S,
>
> Application("SiteDropDownList5") = S
> Application("Initialized") = True
>
>
> Then just used this dynamically generated HTML on my pages.
>
>
> Please Select: <%=Application("SiteDropDownList4")%>
>
>
> Is this normal?
>
>

 
Reply With Quote
 
 
 
 
Bob Barrows [MVP]
Guest
Posts: n/a
 
      12-30-2005
wrote:
> I do not consider myself a ASP expert by any means so I must ask this
> question to see if this is normal or if there is a better way.
>
> I have a web site that I have developed that uses a lot of DB lookups
> for Comboboxes and sections, as well as other configs- All in a
> database.
>
> Instead of having this done on EVERY page via direct DB lookups.... We
> are talking lots of SQL lookups for every page.
>
> What I want to do is have an included page say SiteHeader.ASPX and do
> the following
>
> If Not Application("Initialized") then
> InitializeMyApplication()
>
>
> InitializeMyApplication() Will Do all the database Lookups and create
> dropdowns dyanmicly and assign it to a string -- say S,
>
> Application("SiteDropDownList5") = S
> Application("Initialized") = True
>
>
> Then just used this dynamically generated HTML on my pages.
>
>
> Please Select: <%=Application("SiteDropDownList4")%>
>
>


I was about to suggest using the Cache, but Dale beat me to it. So, instead
i'll leave you with this boilerplate:

There was no way for you to know it, but this is a classic asp newsgroup.
While you may be lucky enough to find a dotnet-knowledgeable person here who
can answer your question, you can eliminate the luck factor by posting your
question to a group where those dotnet-knowledgeable people hang out. I
suggest microsoft.public.dotnet.framework.aspnet.


--
Microsoft MVP - ASP/ASP.NET
Please reply to the newsgroup. This email account is my spam trap so I
don't check it very often. If you must reply off-line, then remove the
"NO SPAM"


 
Reply With Quote
 
 
 
Reply

Thread Tools

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are Off


Similar Threads
Thread Thread Starter Forum Replies Last Post
Safe mode Vs normal mode Echy Firefox 6 08-27-2005 07:56 PM
Is my CPU...normal? Flukemanguy Hardware 14 08-14-2005 03:58 AM
Is this normal for a 2600 router? Michael Love Cisco 5 04-13-2004 06:41 PM
Is this Normal??? justin Cisco 4 10-16-2003 12:19 AM
Calling .Net Objects from normal ASP Elrond Bishop ASP .Net 0 09-10-2003 12:27 PM



Advertisments
 



1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57