Vulnerability in EPiServer.Forms
We're looking to move images from EpiServer into a CDN, so we want to edit URLs contained in a BlockData object before they are used. (This part we know how to do).
But we also want to add the published date onto the URL so that the CDN will see each update as a new resource and update straight away. How can we get the associated Publish date time information for a URL inside a BlockData.
I've seen that there is a "Saved" property on the PageData object which seems to have the correct date time information that we want, but I don't know how to access this in relation to the URL.
Could be useful for your blocks:
public abstract class BaseBlockData : BlockData
public DateTime LastModified
var changeTrackable = this as IChangeTrackable;
return changeTrackable != null ? changeTrackable.Saved : DateTime.MinValue;
Thanks for the reply Valdis, but this doesn't seem to work.
changeTrackable is always null, as there is nothing in BlockData's inheritance heirachy which implements IChangeTrackable
Sorry, that was for pages. Try
IModifiedTrackable only returns a bool, we'd like to read the DateTime of the last update/publishIs there a way to find the newest PageData object that the URL or BlockData is part of?
A shared block implements IChangeTrackable, even if you can't see it by looking at The BlockData class. Read more here.
So converting to IChangeTrackable should work, and you can get the Saved property. Converting to IVersionable will also work, if you want to get the StartPublish property. If you need the name property, simply convert to IContent.
Yes, I forgot that IChangeTrackable was injected by Castle proxy. So this cast is valid only in runtime. Try it out.
It seems like we are using local blocks rather than shared blocks as described here
We are not creating the BlockData using IContentRepository
I've looked through the block's members in the debugger at runtime and it doesn't seem to have been updated with the information we need
Also we are using version 7.0.586.1 along with the EpiBoost Library - https://epiboost.codeplex.com/