Monday 17 March 2014

Difference between Session object and Profile object in ASP.NET?

Difference between Session object

Profile
1.Profile object is persistent.
2.Profile object uses the provider model to store information.
3. Profile object is strongly typed.
4. Mostly used for anonymous users.

Session
1.Session object is non-persistant.
2.Session object uses the In Proc, Out Of Process or SQL Server Mode to store information.
3. Session object is not strongly typed.
4. Used for authenticated users.


Characteristics
Profile
Session
Scope
Each user has his own profile object
Each user has his own session object
Strongly typed nature
Profile object is strongly typed
Session object is not strongly typed and requires type casting when assigning and retrieving from the session object
Persistent duration
Profile values are available for the users, even between visits
Session object contents are available only for the duration of the current browser session
Persistent location
Profile object can be stored in a SQL Server Express database or in a SQL Server database and can be configured through the Web Site Administration tool
Session object can be configured to be stored in a database, IIS in-process, or in a session state server, depending on the configuration setting
Performance
Profile may have a negative impact on performance because of the chatty interface between the profile object and the persistent data store
Can be configured using properties such as EnableSessionState attributes at the page level
IntelliSense
Provides IntelliSense because of its strongly typed nature
No support for IntelliSense
 

No comments:

Post a Comment