problems with public properties

Discussion in 'ASP .Net' started by pietaster, Dec 30, 2003.

  1. pietaster

    pietaster Guest

    I really dont know what I should do. I am asking for best practices.

    currently I create my properties by doing this.

    Context.Items.Add("Info", new Info(Request.QueryString["acct"],
    Request.QueryString["option"]));

    Info is a class that I call that places all data retrieved from a db
    into public properties.

    I get the data by:

    Info my = (Info) HttpContext.Current.Items["Info"];

    but as you all know this does not work because Context is for current
    request.

    I have multiple tabs and I bring all my data in at the beginning and
    then by using public properties I populate the different tabs.

    What can I do that will ensure I am able to retrieve my public
    properties for each tab. I'm sure I need to use session but I am not
    sure the best way.


    Please help,
    Thanks pietaster
     
    pietaster, Dec 30, 2003
    #1
    1. Advertising

  2. pietaster

    Hermit Dave Guest

    Well if you have same tabs for all users then its a waste using Session to
    store the data for you to retrieve from.
    Application used the common place for global data dump in ASP days.... but
    now you have a more flexible Cache object. If you want to store
    anything...,. cache is the place...
    You can still use Application but if it starts running out of memory... it
    causes the applicaiton to restart... on the other hand cache is smarter.. it
    just starts chucking things out based on it priority settings...

    hope this helps....

    --
    Regards,

    HD

    "pietaster" <> wrote in message
    news:...
    > I really dont know what I should do. I am asking for best practices.
    >
    > currently I create my properties by doing this.
    >
    > Context.Items.Add("Info", new Info(Request.QueryString["acct"],
    > Request.QueryString["option"]));
    >
    > Info is a class that I call that places all data retrieved from a db
    > into public properties.
    >
    > I get the data by:
    >
    > Info my = (Info) HttpContext.Current.Items["Info"];
    >
    > but as you all know this does not work because Context is for current
    > request.
    >
    > I have multiple tabs and I bring all my data in at the beginning and
    > then by using public properties I populate the different tabs.
    >
    > What can I do that will ensure I am able to retrieve my public
    > properties for each tab. I'm sure I need to use session but I am not
    > sure the best way.
    >
    >
    > Please help,
    > Thanks pietaster
     
    Hermit Dave, Dec 30, 2003
    #2
    1. Advertising

  3. Check out the Cache object -- it is the new replacement for the older
    Application collection in ASP.

    Cache supports many methods of storing data smartly (like cache timeouts,
    refreshes, etc..) and shares data across sessions.


    --------------------------------------------------------------------
    This reply is provided AS IS, without warranty (express or implied).


    --------------------
    >From: (pietaster)
    >Newsgroups: microsoft.public.dotnet.framework.aspnet
    >Subject: problems with public properties
    >Date: 30 Dec 2003 09:44:03 -0800
    >Organization: http://groups.google.com
    >Lines: 27
    >Message-ID: <>
    >NNTP-Posting-Host: 159.53.206.142
    >Content-Type: text/plain; charset=ISO-8859-1
    >Content-Transfer-Encoding: 8bit
    >X-Trace: posting.google.com 1072806244 7344 127.0.0.1 (30 Dec 2003

    17:44:04 GMT)
    >X-Complaints-To:
    >NNTP-Posting-Date: Tue, 30 Dec 2003 17:44:04 +0000 (UTC)
    >Path:

    cpmsftngxa07.phx.gbl!cpmsftngxa06.phx.gbl!cpmsftngxa09.phx.gbl!TK2MSFTNGP08.
    phx.gbl!newsfeed00.sul.t-online.de!t-online.de!npeer.de.kpn-eurorings.net!ne
    ws.tele.dk!news.tele.dk!small.news.tele.dk!news.maxwell.syr.edu!postnews1.go
    ogle.com!not-for-mail
    >Xref: cpmsftngxa07.phx.gbl microsoft.public.dotnet.framework.aspnet:198908
    >X-Tomcat-NG: microsoft.public.dotnet.framework.aspnet
    >
    >I really dont know what I should do. I am asking for best practices.
    >
    >currently I create my properties by doing this.
    >
    >Context.Items.Add("Info", new Info(Request.QueryString["acct"],
    >Request.QueryString["option"]));
    >
    >Info is a class that I call that places all data retrieved from a db
    >into public properties.
    >
    >I get the data by:
    >
    >Info my = (Info) HttpContext.Current.Items["Info"];
    >
    >but as you all know this does not work because Context is for current
    >request.
    >
    >I have multiple tabs and I bring all my data in at the beginning and
    >then by using public properties I populate the different tabs.
    >
    >What can I do that will ensure I am able to retrieve my public
    >properties for each tab. I'm sure I need to use session but I am not
    >sure the best way.
    >
    >
    >Please help,
    >Thanks pietaster
    >
     
    Charlie Nilsson [MSFT], Dec 30, 2003
    #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. Charles A. Lackman
    Replies:
    1
    Views:
    1,423
    smith
    Dec 8, 2004
  2. SpamProof
    Replies:
    0
    Views:
    618
    SpamProof
    Oct 21, 2003
  3. Kevin Spencer
    Replies:
    2
    Views:
    3,331
    Kevin Spencer
    Sep 15, 2004
  4. Steve Mauldin
    Replies:
    5
    Views:
    1,743
    Steve Mauldin
    Jan 26, 2006
  5. KJ
    Replies:
    0
    Views:
    130
Loading...

Share This Page