Is this normal methodology?

Discussion in 'ASP General' started by Tapplication@gmail.com, Dec 30, 2005.

  1. Guest

    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?
    , Dec 30, 2005
    #1
    1. Advertising

  2. Dale Guest

    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/default.asp?url=/library/en-us/cpguide/html/cpconCacheAPIs.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?
    >
    >
    Dale, Dec 30, 2005
    #2
    1. Advertising

  3. 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"
    Bob Barrows [MVP], Dec 30, 2005
    #3
    1. Advertising

Want to reply to this thread or ask your own question?

It takes just 2 minutes to sign up (and it's free!). Just click the sign up button to choose a username and then you can ask your own questions on the forum.
Similar Threads
  1. imavroid
    Replies:
    0
    Views:
    829
    imavroid
    Mar 12, 2006
  2. Replies:
    3
    Views:
    431
    Clint Hill
    Jul 25, 2005
  3. Imran Aziz
    Replies:
    2
    Views:
    1,203
    Imran Aziz
    Aug 5, 2005
  4. Ted Holden

    CORBA or some other methodology?

    Ted Holden, Nov 18, 2004, in forum: Java
    Replies:
    12
    Views:
    587
    ted holden
    Nov 22, 2004
  5. arieljake
    Replies:
    3
    Views:
    332
    arieljake
    Feb 9, 2005
Loading...

Share This Page