james mckay dot net
because there are few things that are less logical than business logic

IIS oddity

I’ve now got a “contact me” form up and running on my website for anyone who wants to get in touch. Coding and testing it on my laptop this evening threw up a rather bizarre bug in IIS 5 though.

It seems that IIS 5 doesn’t like you to do a POST request to a default page without explicitly specifying the name of the page. So for instance, if you have a form like this (very simple) one on your site:

<form method="POST">
      <input name="test" type="text" />
      <input type="submit" />

If it’s saved as index.php or default.aspx or some other default document name, and you call it up using “http://localhost/test/”, clicking the submit button gives a “405 Resource Not Allowed” error. It works fine if you use “http://localhost/test/index.php” or “http://localhost/test/default.aspx” or whatever though.

However, if you call the file default.htm (or indeed anything else ending with a .htm extension) it gives you this error whether you specify the filename or not.

It turns out that this is a bug in IIS 4 and 5, which has been fixed in IIS 6. Not very helpful given that you can’t install IIS 6 on Windows XP Professional.

It’s not much of an issue, given that my live blog is running on an Apache server on Linux, but since I’m using Windows XP/IIS 5 for testing tweaks to the template and new widgets such as the contact form etc, it’s only slightly irritating. It is also something that you need to be aware of if your website is still running on Windows 2000 Server rather than Windows Server 2003.

Or perhaps I should just use Apache for Windows…