asp.nethttpcontextapplication-statehttpapplicationstate

Why do we need StaticObjects collection when HttpApplicationState can be handled by HttpContext


i just read we can access HttpApplicationState using Application or StaticObjects

I am not clear as why we need two different approach as all i can see is Application will help you to add and read in the code level while using staticobjects we can add it in mark-up of global.asax and read but not update

Is this the only difference or Am I missing some core functionality of static objects


Solution

  • See HttpApplicationState.StaticObjects property:

    Application objects are defined in the Global.asax file inside the <object runat="server" scope="Application"> </object> tags.