Archive for the ‘asp’ Category

IE8 aggressive caching fix

2009-03-20

Apparently Internet Explorer 8 has a more aggressive caching mechanism than any other browser I’ve ever met. To fix it I’ve added the following to almost every dynamic page on my server.

<%
// prevent caching (asp classic jscript)
Response.CacheControl = "no-cache";
Response.AddHeader("Pragma", "no-cache");
Response.Expires = -1;
%>
<%
' prevent caching (asp classic vbscript) '
Response.CacheControl = "no-cache"
Response.AddHeader "Pragma", "no-cache"
Response.Expires = -1
%>
<?php
// prevent caching (php)
header('Cache-Control: no-cache');
header('Pragma: no-cache');
header('Expires: ' . gmdate(DATE_RFC1123, time()-1));
?>
// prevent caching (C#)
//Response.AddHeader("Cache-Control", "no-cache");
//Response.AddHeader("Pragma", "no-cache");
//Response.Expires = -1;

Response.Cache.SetCacheability(HttpCacheability.NoCache);
Response.Cache.SetNoStore();
Response.Cache.SetExpires(DateTime.MinValue);

More information here: How to prevent caching in Internet Explorer

Generate Excel files in ASP Classic

2009-03-02

Generating Excel files in ASP Classic is not as easy as I thought. I hope someone finds use in this little piece of code that shows a way to export data to csv and to xls.

(more…)

XSLT transform in asp with Microsoft.XMLDOM

2007-10-31

I recently had to transform an xml file into a scorm manifest file. I wanted it to be in UTF-8, but Microsoft.XMLDOM‘s transform method disregards the encoding setting in xsl:output. The transformNodeToObject method doesn’t. I also found out I had to use the save method on the output object instead of writing a file based on the xml property. You’ll find the function I ended up writing to assist me below:

(more…)