Re: Accessing Application State on a Cache Expiration

Discussion in 'ASP .Net' started by Natty Gur, Aug 7, 2003.

  1. Natty Gur

    Natty Gur Guest

    Hi,

    You can’t access the HttpContext.Current because when the callback
    function call there isn’t any client request or to be more accurate the
    callback isn’t attach to any request. To overcome it create private
    member of application type in the global class and set it to the
    application when the application start. Use the application private
    member.

    Check out my sample:
    http://www.developersdex.com/gurus/code/653.asp

    Natty Gur, CTO
    Dao2Com Ltd.
    34th Elkalay st. Raanana
    Israel , 43000
    Phone Numbers:
    Office: +972-(0)9-7740261
    Fax: +972-(0)9-7740261
    Mobile: +972-(0)58-888377


    *** Sent via Developersdex http://www.developersdex.com ***
    Don't just participate in USENET...get rewarded for it!
    Natty Gur, Aug 7, 2003
    #1
    1. Advertising

  2. >
    > You can't access the HttpContext.Current because when the callback
    > function call there isn't any client request or to be more accurate the
    > callback isn't attach to any request. To overcome it create private
    > member of application type in the global class and set it to the
    > application when the application start. Use the application private
    > member.
    >


    Hmmm. That's kinda what I figured I'd have to do (except I have to
    use a Public Static (Shared in VB) as I need to get at it from several
    classes). Thanks for the info.

    You don't need to go through all that for your example though. Just
    use System.Web.HttpRuntime.Cache to access the Cache from anywhere,
    like a callback not attached to a request in a different class.

    That's why I kinda figured there's be another way to get to the
    ApplicationState, since they made the Cache available.

    John
    John McDowell, Aug 7, 2003
    #2
    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. Jeff
    Replies:
    1
    Views:
    345
    Teemu Keiski
    Apr 23, 2004
  2. Dicky Cheng

    absolute expiration doesn't expire cache

    Dicky Cheng, Aug 13, 2004, in forum: ASP .Net
    Replies:
    2
    Views:
    506
    Dicky Cheng
    Aug 16, 2004
  3. Steffen Loringer

    Cache expiration

    Steffen Loringer, Oct 14, 2004, in forum: ASP .Net
    Replies:
    1
    Views:
    333
    Hans Kesting
    Oct 14, 2004
  4. Felix Planjer
    Replies:
    1
    Views:
    431
    bruce barker
    Dec 6, 2004
  5. Sashko
    Replies:
    1
    Views:
    738
    Joerg Jooss
    Jun 22, 2006
Loading...

Share This Page