ImageCodecInfo: Encoder and Decoder information

January 25, 2010

If you’ve ever been curious about the GDI+ encoders and decoders available on your system, you can call ImageCodecInfo.GetImageEncoders() and ImageCodecInfo.GetImageDecoders(), respectively, to find out more:

Continue reading...

Free ZIP Code Database (data provided by PopularData.com)

November 21, 2009

PopularData.com provides a free list of U.S. ZIP codes in CSV format on their Web site.  I have taken the liberty of using that data to generate a SQL script that will create a [ZipCode] table in your SQL Server 2005 database and populate it with over 42k unique U.S. ZIP codes.  Schema details can be found on this page.

Continue reading...

"HTTP Error 401.1 - Unauthorized" when using Windows Authentication on IIS7.5

September 21, 2009

You may have run into this error while trying to develop a site that uses Integrated Windows Authentication on Windows Server 2008 R2 with IIS7.5.  I sure did, and I beat my head against the wall for a couple of hours trying to figure it out.

Continue reading...

GraffitiCMS 1.2 export utility

August 29, 2009
Update 2010-09-29: This code has been moved to BitBucket: http://bitbucket.org/jonsagara/graffititoblogml

Continue reading...

Ordered a new computer

November 19, 2008

But it can’t get here soon enough.

Continue reading...

Enumerating HttpModules

August 24, 2008

One common ASP.NET performance tip is to remove any HttpModules that your application does not use.  You can take a peek at which modules are loaded by the framework on your behalf by examining the framework’s Web.config file, but how do you find out which modules are actually loaded in the current context?

Continue reading...

try/swallow

August 21, 2008

Dear fellow coders,

Please don’t ever do this:

Continue reading...

HttpValueCollection.ToString() generates your nice query strings

May 24, 2008

In an ASP.NET page, if you call Request.QueryString.ToString(), you’ll get a nicely formatted query string back, like this:

1
my=query&string=value&foo=bar

“That’s nice,” I thought. “I wonder how they implemented it. I’ll fire up Reflector and take a look.”

Continue reading...

Response.Redirect and the ThreadAbortException, and why it’s a good thing

April 5, 2008

A couple of months ago, I ran into a problem where I was seeing a bunch of ThreadAbortExceptions showing up in my logs. It didn’t take long to track down why – I was calling Response.Redirect from within a try/catch block in my ASP.NET code-behind page, and the catch block was catching the ThreadAbortException and writing it out to the log. But why was the ThreadAbortException being generated?

Continue reading...