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 and Autofixture) 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.

1 Answer 1



Custom properties from Context.User.Profile are stored together with user profiles. It may vary between Sitecore versions where this data is stored and how it's accessed but in general they sit together with other aspnet membership provider data in core database in aspnet_Profile table.

So whenever you call


the data is persisted in the database. And it's also accessible right after UserResolver class in httpRequestBegin pipeline.

Session variables

Session variables only leave during user's browser session - when session expires, the data is gone.

Session is not accessible within httpRequestBegin pipeline as it is called before the session is initialized.

Additional info

You can read more about session vs profile data in



Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.