Accessing Application State on a Cache Expiration

Ask a Question related to ASP.NET General, Design and Development.

  1. #1

    Default Re: Accessing Application State on a Cache Expiration

    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:
    [url]http://www.developersdex.com/gurus/code/653.asp[/url]

    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 [url]http://www.developersdex.com[/url] ***
    Don't just participate in USENET...get rewarded for it!
    Natty Gur Guest

  2. Similar Questions and Discussions

    1. Advantages of empty Application Base State?
      Several examples are coded where the Main.mxml base state is empty and there is a child state called e.g. main App (start) containing the initial...
    2. Accessing the Memoize cache
      I have an expensive function my_cmp that I'd like to Memoize. Is there any way I can take advantage of the property that my_cmp($a,$b) == -...
    3. How to cache Acrobat Distiller application in Windows?
      Hi all, We have developed a program which will call the macro to convert MSWord doc to pdf using Acrobat 6.0. However, we found that it runs...
    4. Object in application state
      If have an object with a variable i stored in the application state in the asp.net application. Is there a way to force this object in the...
    5. Application state
      Is everything stored in Application or Session state boxed? For example: Application = 10; Is there boxing involved? Thanks. Just learning...
  3. #2

    Default Re: Accessing Application State on a Cache Expiration

    >
    > 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 Guest

Posting Permissions

  • You may not post new threads
  • You may post replies
  • You may not post attachments
  • You may not edit your posts

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 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 129 130 131 132 133 134 135 136 137 138 139