Excluding WebResource.axd, or "How to initially compress what you want"
This is kind of an extension to my earlier post on Blowery.web and ScriptResource.axd. I've completed the migration to dasBlog 1.9.7-ish (doesn't it look awesome?). Which probably wasn't a wise thing to do since a brand new release version is expected in the next couple of weeks after which time, it looks like I won't need to upgrade the project to ASP.NET 2.0 myself anymore. But Scott's timing doesn't mesh with my vacation schedule (come June 14, I's be a European Hillbilly for a couple of weeks).
Tweaking dasBlog to work with the current version of ASP.NET AJAX and the AJAX Toolkit will wait for a future post. For now, I just want to discuss an issue that actually came up the last time I did this but I didn't look into it in much detail. Essentially, whenever a postback was required (posting a comment, updating the configuration, etc, etc, and so on and so forth), I would get an error that WebForm_PostBackOptions was undefined.
The most likely reason for this: Something is messed up with your WebResource.axd file. I know not the details of this file but apparently it is required for ASP.NET 2.0 forms to do postbacks. And in fact, it's not actually a file but a file served up by (I think) an HTTP handler.
So if you get this error, chances are the WebResource.axd file isn't doing its job. Or the HTTP handler isn't do its job and isn't even serving up WebResource.axd. The easy way to check for that is to look at your page source and see if you can find a line like the following:
<script
src="/ajaxtoolkit/WebResource.axd?d=cCvonavza7NGh4PxQfj5rw2&t=633135374249468480"
type="text/javascript"></script>
The path to WebResource.axd will be different of course (this was taken from one of the samples over at http://ajax.asp.net/ajaxtoolkit). If you can't find that reference, I dunno, try Google to see if you need to register an HTTP handler somewhere. Maybe your ISP doesn't have it in the machine.config. I haven't run into this particular problem.
The one I *have* hit is when the reference to WebResource.axd does exist but you still get this message. Normally, when you navigate to the path specified by the <script> tag, you'll see a bunch of javascript (with the very first function being WebForm_PostBackOptions, in fact). But if you get this message, you will probably get a blank HTML page when you navigate to WebResource.axd.
As happened last time, I had to add WebResource.axd to the excluded paths for <blowery.web>. I guess this isn't a file that want compressed (although ScriptResource.axd seems to handle it fine, provided blowery is the only thing compressing it).
And just like last time, when I moved it to my server, it didn't work. This time though, I was a little wiser and had more time to kill so I thought I'd try to track it down.
Turns out you don't exclude WebResource.axd from compression in blowery.web. Rather you need to exclude ebResource.axd. That's not a typo. Here is what my blowery.web section looks like:
<blowery.web>
<httpCompress preferredAlgorithm="gzip" compressionLevel="high">
<excludedPaths>
<add path="WebResource.axd"/>
<add path="ebResource.axd"/>
</excludedPaths>
<excludedMimeTypes>
<add type="image/jpeg"/>
<add type="image/gif"/>
</excludedMimeTypes>
</httpCompress>
</blowery.web>
For whatever reason, blowery has code that skips the first letter in its excluded paths. And I can't take any credit for discovering this.
So there you have it. I now have a current dasBlog installation with compression turned on. You can tell all your friends about me now.
Kyle the Decompressed