I am trying to create a control that will deliver any specific version of a sharepoint publishing page to anonymous users. Example:
MyPage.aspx has versions 1.0, 2.0, 3.0, 4.0, with 4.0 being the latest published verison. Sharepoint by default will deliver version 4.0 to anonymous users. I want to be able to programmatically give them version 2.0 instead. I know how to check for anonymous users, and get the object for the version of the page that I want. My question is, how do i tell sharepoint to deliver the specified page object?
Below is what I am working with so far...
PublishingPage currentPage = GetCurrentPageObjectVersion(2);
if (currentPage != null)
{
// Tell sharepoint to deliver currentPage somehow?
}
private SPFileVersion GetCurrentPageObjectVersion(int requestedVersion)
{
SPFileVersion specifiedVersion = null;
try
{
PublishingPage currentPage = PublishingPage.GetPublishingPage(SPContext.Current.ListItem);
specifiedVersion = currentPage.ListItem.File.Versions.GetVersionFromID(requestedVersion);
}
catch (Exception e)
{
// Error handling here
}
return specifiedVersion;
}
Any help would be greatly appriciated! Please let me know if any further clarification is needed!