User's Recently Visited Sites
-
22-10-2019 - |
Pergunta
Anyone have any advice on the best way of tracking the recent sites a user has visited?
As part of my overridden Global Navigation delegate control, I'd like to create something similar to a breadcrumb, but instead displays the last 4 sites (SPWeb objects) the user visited regardless of hierarchical relationship.
Thanks.
Solução 2
Enabling session state would have worked (I successfully implemented it this way first). But since I am working with a Standard license I was able to add a custom multivalued string property to the user profile property bag.
Then inside my delegate control I access the property with the following:
SPServiceContext serviceContext = SPServiceContext.GetContext(SPContext.Current.Site);
UserProfileManager profileManager = new UserProfileManager(serviceContext);
UserProfile user = profileManager.GetUserProfile(false);
ProfileValueCollectionBase siteValues = user.GetProfileValueCollection("LastFourSitesProperty");
Outras dicas
You need to build something to get this to work. In you custom global nav you could either store the navigation history in a cookie, in a db, in-memory or whatever you prefer.