OASIS Mailing List ArchivesView the OASIS mailing list archive below
or browse/search using MarkMail.

 


Help: OASIS Mailing Lists Help | MarkMail Help

 


 

   Re: Prevent caching.

[ Lists Home | Date Index | Thread Index ]
  • From: "Mike Sharp" <msharp@lante.com>
  • To: Johan Warman <johan.warman@abaris.se>
  • Date: Mon, 5 Jun 2000 15:10:04 -0700



To expand on Rick's suggestion, on my current project, we have a number of ASP
pages, in the same environment you're talking about (IIS4, IE5, ASP and XSL)
that generate XML dynamically with a dll.  I try to handle this simply, so
whenever I call the dll that generates xml, I do it from a *separate* page than
the one the client is viewing.  Then I set the response header on that page to:

<% Response.Expires = -1000 %>

I set this at the top of any page that generates XML.  The client page loads the
xml using the XMLHTTPRequest object, which (if your application is restricted to
IE 5 and up) is a *very* slick method of dynamically getting data without
refreshing the client page.  For example, if you have a Order.asp page, you
create a basOrder.asp page that actually does the fetching of the XML -- really
it does ALL the server side work for you -- and call that page from the
Order.asp page using either Remote Scripting, or the XMLHTTPRequest object.  The
advantage of this approach is that if you have static XSL files, they will be
cached for optimum performance, and only the dynamic content will be refreshed
each time.  Even if you use dynamic XSL files, you should extract the dynamic
content from them as XML data, and use another XML-XSL transformation to
generate the XSL file you want to end up with.  In this way, often with more
than one transformation, you can keep the bulk of the text that goes to the
client as static XSL.

Here's the details on the response.expires property, from MSDN:
When your .asp file calls Response.Expires, IIS creates an HTTP header
indicating the time on the server. If the system time on the client is earlier
than the system time on the server (due to either the client or server having an
inaccurate time setting, or time-zone differences) setting the parameter to 0
will not have the effect of expiring the page immediately. You can use the
Response.ExpiresAbsolute property to achieve immediate expiration of a page. In
addition, you can use a negative number for the Expires property. For example

<%Response.Expires = -1 %>

will expire the response immediately. I choose -1000 because I read somewhere
that there are cases where -1 might not cause the page to immediately
expire....but I really suspect it doesn't matter.  Using this method, I have
only rarely had problems in development with caching, and those have always been
fixed by closing the browser and loading the main page again.  And the few
caching problems that do turn up never show up in production or testing.

Regards

Mike Sharp

Senior Site Developer
Lante Corporation

"Experience is something you don't get until just after you need it. "  -- KPIG








Johan Warman <johan.warman@abaris.se> on 06/04/2000 11:59:57 PM

To:   "'xml-dev@xml.org'" <xml-dev@xml.org>
cc:    (bcc: Mike Sharp/Lante)

Subject:  Prevent caching.



Hi

I've wrote some dll's that generates xml-documents. My problem is that when
I create a new doc with same name as an old one, the old one is cached and I
have to reload the doc manually. Does anybody have a clue how to avoid this.
I'm using IIS4, MS IExplorer 5.0, ASP and XSL.

Thanx in advance.

.johan






***************************************************************************
This is xml-dev, the mailing list for XML developers.
To unsubscribe, mailto:majordomo@xml.org&BODY=unsubscribe%20xml-dev
List archives are available at http://xml.org/archives/xml-dev/
***************************************************************************




 

News | XML in Industry | Calendar | XML Registry
Marketplace | Resources | MyXML.org | Sponsors | Privacy Statement

Copyright 2001 XML.org. This site is hosted by OASIS