What is the difference between session object and application object?

Collapse
X
 
  • Time
  • Show
Clear All
new posts
  • gosai jahnvi
    New Member
    • Apr 2019
    • 22

    What is the difference between session object and application object?

    What is the difference between session object and application object?
  • HelenMkt
    New Member
    • Mar 2019
    • 7

    #2
    Session variables are used to store user specific information where as in application variables we can't store user specific information.

    Default lifetime of the session variable is20 mins and based on the requirement we can change it.



    Application variables are accessible till the application ends.

    sessions allows information to be stored in one page and accessed in another,and it supports any type of object,includin g your own custom data types.



    Application state allows you to store global objects that can be accessed by any client.

    The coomon thing b/w session and application is both support the same type of objects,retain information on the server, and uses the same dictionary -based syntax.

    Comment

    • AjayGohil
      New Member
      • Apr 2019
      • 83

      #3
      Session object
      Session object is used to store state specific information per client basis. It is specific to particular user. Session data persists for the duration of user session you can store session's data on web server in different ways. Session state can be configured using the <session State> section in the application's web.config file.
      Application object
      Application object is used to store data which is visible across entire application and shared across multiple user sessions. Data which needs to be persisted for entire life of application should be stored in application object.
      In classic ASP, application object is used to store connection strings. It's a great place to store data which changes infrequently. We should write to application variable only in application_Ons tart event (global.asax) or application.loc k event to avoid data conflicts. Below code sample gives idea

      Comment

      • Sherin
        New Member
        • Jan 2020
        • 77

        #4
        Application object

        The Application object is used to store and access variables from any page, just like the Session object.
        The difference is that ALL users share ONE Application object (with Sessions there is ONE Session object for EACH user).

        Application object is used to store application specific data into server memory
        Application["MyData"]="Gobal value"


        Session object

        ASP solves this problem by creating a unique cookie for each user.
        The cookie is sent to the user's computer and it contains information that identifies the user.
        This interface is called the Session object.
        The Session object stores information about, or change settings for a user session.

        Session object is used to store user specific data into server Memory.
        Session["MyData"]="Store this data"

        Comment

        Working...