Try our conversational search powered by Generative AI!

New Page indicator

Vote:
 

Hi,

it's possible to know if a user has read/visited a page?

 Thanks!

#32672
Sep 11, 2009 15:22
Vote:
 

 

Could you explain what are you trying to achieve or what is your requirement?

#32676
Sep 11, 2009 15:59
Vote:
 

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

 

 

#32784
Sep 17, 2009 14:22
Vote:
 

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

 

 

#32787
Sep 17, 2009 15:30
Vote:
 

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

#32843
Sep 21, 2009 13:47
Vote:
 

 

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.

 

 

#32847
Sep 21, 2009 15:23
Vote:
 

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.

 

#32892
Sep 23, 2009 7:26
This thread is locked and should be used for reference only. Please use the Episerver CMS 7 and earlier versions forum to open new discussions.
* 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.