We are using Session as well as Sitecore Custom Property(Context.User.Profile) for state management.
We don't have much data(only around 20 fields ex- user id,email id etc.) for state management.
Following places we find differences between both scope:
- Inside
httpRequestBegin(HttpRequestProcessor class)
pipeline custom implementation we can't get Session variable(HttpContext.Current.Session["User ID"]
) but can get Sitecore Custom Property ex-Sitecore.Context.User.Profile.GetCustomProperty("User ID")
. - Same behavior we faced on some business logic layer class library where we can get/set custom properties but not session.
- Unit test(using
xUnit
framework,Sitecore.FakeDb
,Moq
andAutofixture
) project implementation for Sitecore, here also we are facing issue with session but not for custom properties.
What are differences between Sitecore Custom Property(Context.User.Profile) and Session?
Scenario basis, which one is better to use for state management(if small quantity of data)?
Any suggestion will be appreciated.