Page GET during PublishedPage gets previous version



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();
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"
Aug 02, 2010 12:50

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?

Aug 02, 2010 13:21

Thanks Jørgen.  That did it.

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.