Professional Web Applications Themes

Doubts about application variables - ASP.NET General

Hi. Reading some Microsoft materials about asp.net I came into two doubts. The following sentence is found on the topic "Application State" in the NET Framework doentation: "Calling Lock on the Application object causes ASP.NET to block attempts by code running on other worker threads to access anything in application state" So, if I use Lock this way: Application.Lock() Application("myVar") = 10 Application.UnLock() All the other application variables on my system are blocked too? My second doubt relates to a sentence found on one of the Microsoft asp.net official courses: The topic about application variables says: "The Application object is ...

  1. #1

    Default Doubts about application variables

    Hi.

    Reading some Microsoft materials about asp.net I came into two doubts.

    The following sentence is found on the topic "Application State" in the
    NET Framework doentation:

    "Calling Lock on the Application object causes ASP.NET to block attempts
    by code running on other worker threads to access anything in
    application state"

    So, if I use Lock this way:

    Application.Lock()
    Application("myVar") = 10
    Application.UnLock()

    All the other application variables on my system are blocked too?


    My second doubt relates to a sentence found on one of the Microsoft
    asp.net official courses:
    The topic about application variables says:

    "The Application object is destroyed when all users have exited the Web
    application and the Web
    application is then unloaded."

    To test this, I created some application variables in an asp.net
    application, load them and then exited the application. When I run the
    application again, the application variables are still there with the
    more recent values. It seems to me that application variables are only
    destroyed when their host is destroyed, in this case, the IIS process.
    Can anyone help me to understand the above sentence?

    Regards,

    Chris Leffer



    *** Sent via Developersdex [url]http://www.developersdex.com[/url] ***
    Don't just participate in USENET...get rewarded for it!
    Chris Leffer Guest

  2. #2

    Default Re: Doubts about application variables

    When you call Application.Lock and Application.Unlock, they are applied
    only to the application variable in the current context.

    The application state/variables are destroyed when the web application
    is specifically unloaded..means stopping the IIS or web
    application..Even if there are no active users accessing the web server,
    the application state/variables are preserved until the web application
    is stopped...that is how we generally keep track of the number of
    visitors to a particualr web site.

    Hope this helps...

    --Rao
    Rao Guest

Similar Threads

  1. Problem with Application variables using Application.cfc
    By Hugo Sombreireiro in forum Macromedia ColdFusion
    Replies: 3
    Last Post: April 16th, 02:06 PM
  2. application variables in a CFC
    By whatchamakeofit in forum Coldfusion Component Development
    Replies: 3
    Last Post: May 16th, 02:09 PM
  3. Application variables
    By Philip Carnstam in forum ASP.NET General
    Replies: 4
    Last Post: October 28th, 09:37 PM
  4. DB Field name="application" and Application scope variables
    By VicTci in forum Coldfusion Database Access
    Replies: 2
    Last Post: August 23rd, 06:55 AM
  5. Replies: 1
    Last Post: September 3rd, 01:30 PM

Bookmarks

Posting Permissions

  • You may not post new threads
  • You may not 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