Last Tuesday I got an email from Ken Muse, asking for the source code of the WebResourceHandler. You couldn’t download it, because I was smart enough (not!) to upload the .cs file. I’ve since changed the file to a zip file. Anyway, Ken was the first who ran into this problem and actually contacted me on it. He has taken the source code and implemented the timestamp and substitution feature. He did a very nice job.Here’s the way he got a timestamp, which I think is a pretty nifty way of doing it.
// Validate timestamp
Uri url = new Uri(resourceAssembly.EscapedCodeBase);
long time = File.GetCreationTimeUtc(url.LocalPath).Ticks;
if (time.ToString() != timeStamp)
thrownew ArgumentException(“Specified resource timestamp is invalid.”);
I just checked with Anakrino to see how the ASP.NET team implemented it in Whidbey. Pretty much the same way. They have done some extra stuff with caching support, which is not included yet.
The new source code is included, so everybody can enjoy the enhancements. Kudos to Ken for adding his bits to the code. You can contact Ken and his band Moments From Impact at http://www.momentsfromimpact.com.