November Happy Hour will be moved to Thursday December 5th.
November Happy Hour will be moved to Thursday December 5th.
Could you explain what are you trying to achieve or what is your requirement?
Hi,
i need to create a page that shows a list of all pages that the user has not yet read.
For example news, articles etc.
i need also to show if "today" someone has published a new document, has changed a document, ...
/Ivan
Hi,
You would probably need to create a Session object of all the pages (just once on master page)
PageDataCollection allPages = GetChildren(EPiServer.Core.PageReference.StartPage);
Session["AllPages"] = allPages;
and then update this session object whenever user vists a page
PageDataCollection allPages = (PageDataCollection)Session["AllPages"];
for (int pageIndex = 0; pageIndex < allPages.Count; pageIndex++)
{
PageData page = pages[pageIndex];
//compare the current page id against the session pages
if (page.PageLink.ID == CurrentPage.PageLink.ID)
{
allPages.RemoveAt(pageIndex);
break;
}
else
{
continue;
}
}
Session["AllPages"] = allPages;
In your listing control, you could always request it to dispay EPiServer PageList from the session object.
For your second request you have use UnifiedFile object to get the file and then access file properties to check its date properties.
For example, if you set a file URL property in the template, you can access it as below
string fileUrl = CurrentPage["FilePath"] as string;
UnifiedFile file = HostingEnvironment.VirtualPathProvider.GetFile(fileUrl) as UnifiedFile;
Hope it helps
Hi,
but if i use a session object i store only the pages that the user has read in the current session.
I need to show the pages that the user has not read in "general". Not only in the current session.
/Ivan
Then you have 2 options,
If you have to maintain over a long period of time, then you have to create a custom database tables and store the mapping. The mapping could be between username or IP address against the list of pages.
The other option would be to use cookies for mapping, but it would become difficult to manage and also wont work if someone has cookies disabled.
Thanks,
i know that it's possible to do it with coding and i thought do it approximately as you describe
But i wondered if there is a property in EpiServer that indicate if a user has read the page or not.
Hi,
it's possible to know if a user has read/visited a page?
Thanks!