SaaS CMS has officially launched! Learn more now.

Bookmarks feature in Episerver



I have a requirement to implement bookmarks feature in EpiServer. So when a user logs in, he could mark a content as favorite.

I will be storing userid and corresponding content id in a table. Assuming this will require me to create a new table in EPiServer database (not creating new database here since only one table)

Also when user logs in, I will be quering agains this DB table to fetch all content ids and load those content for user to view.

Can some one guide me on how to proceed on Database interaction in EpiServer and any best practices or reference links. I have seen link in this forum that talks about this feature already so if anyone can post some details that would be helpful.

Sep 27, 2019 19:30

Can not create a complete sample code but I think this will help you. Below link is for Creating table

And, below link is for interaction with database

Hope, you will have a good direction with above examples. Let me know if you need any more help.


Praful Jangid

Sep 27, 2019 20:07
Dileep D - Sep 27, 2019 20:39
Thanks for the Info Praful.
This certainly provides information about database interaction. However am wondering if I should use DDS as in the references you gave or should I be using EF. I am still in research stage so would like to know about different options before I could opt one.
Praful Jangid - Sep 29, 2019 14:32
I have experience with EF and the example I shared above. Those are ease implementation. But, no experience with DDS (I found it little bit tricky). So, I can help you if you face any issue.
Dileep D - Sep 30, 2019 3:32
Thanks Praful,

I need some more information before I can get started on this. The given examples show read and writes to DB which is understandable. Now since I have to create new tables, do I put up in an initialization module which will check if tables are not available in DB then create it or do I just create these tables (probably 1 or 2) manually in the database. Let me know if you have any inputs on this. I am not sure but kind of scary to edit anything in Episerver database.

Two other options

  • Dynamic Data Store (DDS) (link)
  • Inherit from IContent, and store it in the Episerver database (link)
Sep 30, 2019 6:47

There is a 'favorites' sample on GitHub, I can't quite remember how it works as it's quite old, but it might give you some ideas

Sep 30, 2019 14:34

Just to throw another option into the mix, if you're storing favourites against a logged in user, you could use the user's profile to store the data. Setup is simple - just add the required field into your config like this (where I've added Favourites as a list of integers):

<profile defaultProvider="DefaultProfileProvider">
    <add name="Address" type="System.String" />
    <add name="ZipCode" type="System.String" />
    <add name="Locality" type="System.String" />
    <add name="Email" type="System.String" />
    <add name="FirstName" type="System.String" />
    <add name="LastName" type="System.String" />
    <add name="Language" type="System.String" />
    <add name="Country" type="System.String" />
    <add name="Company" type="System.String" />
    <add name="Title" type="System.String" />
    <add name="CustomExplorerTreePanel" type="System.String" />
    <add name="FileManagerFavourites" type="System.Collections.Generic.List`1[System.String]" />
    <add name="EditTreeSettings" type="EPiServer.Personalization.GuiSettings, EPiServer.Cms.AspNet" />
    <add name="ClientToolsActivationKey" type="System.String" />
    <add name="FrameworkName" type="System.String" />
    <add name="Favourites" type="System.Collections.Generic.List`1[System.Int32]" />

You can then access, modify and save the data like this:

var profile = EPiServerProfile.Current;
var favourites = (profile["Favourites"] as List<Int32>) ?? new List<Int32>();
if (!favourites.Contains(currentPage.ContentLink.ID))
Sep 30, 2019 16:15
Dileep D - Sep 30, 2019 17:15
This looks interesting. Is this the EPi Advance profile store ? Wondering what profile is this. Could you please give me some more information on this. Also I may have to keep the order of favourites too but I believe I can do that at client side and save the list accordingly.
Paul Gruffydd - Sep 30, 2019 18:24
No. EPiServerProfile is an Episerver wrapper around .Net profile functionality so isn't reliant on external services like Profile Store. It's also used by the Episerver UI to store display preferences for users.

If you do have access to Profile Store you could store the favourites against the user's Profile Store profile though. That would allow for a lot more options in querying and aggregating the data at a later date.
* You are NOT allowed to include any hyperlinks in the post because your account hasn't associated to your company. User profile should be updated.