November Happy Hour will be moved to Thursday December 5th.

Page GET during PublishedPage gets previous version

Vote:
 

Hi

I'm trying to create a PDF version of report pages during the PublishedPage event.  I'm using a 3rd party utility to do this which converts the HTML to PDF.  However, when I do a GET of the page to get the HTML for this conversion, I'm getting the previous version of the page.  Is there any way to get the latest version, i.e. the one I've just published?

I'm subscribing to the event like this:

DataFactory.Instance.PublishedPage += new PageEventHandler(this.PublishedPage_CreatePdf);

I'm doing the GET with an HttpWebRequest:

HttpWebRequest webRequest = WebRequest.Create(fullUrl) as HttpWebRequest;
WebResponse response = webRequest.GetResponse();
Stream stream = response.GetResponseStream();
StreamReader responseReader = new StreamReader(stream);
string responseData = responseReader.ReadToEnd();
responseReader.Close();
So I've fed in the URL of the page to this request, but I'm getting back HTML content for the previous version, not the one that has just been "Published"
#41880
Aug 02, 2010 12:50
Vote:
 

It almost sounds like the request happens before EPiServer can invalidate the cache, can you try adding: DataFactoryCache.RemovePage(e.PageLink); before the web-request and see if it helps?

#41881
Aug 02, 2010 13:21
Vote:
 

Thanks Jørgen.  That did it.

#41883
Aug 02, 2010 14:59
This topic was created over six months ago and has been resolved. If you have a similar question, please create a new topic and refer to this one.
* 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.