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();
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?
Thanks Jørgen. That did it.