Petes random thoughts and jottings

Feb 26
Special offer pricing FAIL

Special offer pricing FAIL


Feb 18

Mime types on IIS7

I host quite a few mp4 videos on our webserver which runs IIS7. By default, IIS7 doesnt have the mime type set for mp4 and thus returns an error of 404 if you try to access the file. This is done for security reasons (so people cant access secure files by default eg .inc, .cs etc). Thats a valid point but mp4 is quite common as a format especially these days so why isnt that one made available?! Anyway, in IIS7 I came across quite a nice solution, you can additional mime types to the web.config. Here is a sample:

<system.webServer>
<staticContent>
<mimeMap fileExtension=”.mp4” mimeType=”video/mp4” />
<mimeMap fileExtension=”.m4v” mimeType=”video/m4v” />
</staticContent>
</system.webServer>

I like that, if we ever move to another server thats one less thing to have to remember to set up.


Jan 28

Dec 22

IIS 7 Enabling PUT request

Im doing some funky restful services and was setting it up on a laptop. BUT PUT requests werent working (always returning a 405 error - Method not allowed). The fix was to uninstall WebDav publishing as a feature of IIS. And then it worked straight away.

Some people were talking about Webdav is forcing you to make authorised requests for PUT but I was and it wasnt working. Simplest solution was to remove it as I didnt need it.


Dec 17

Dec 14

IIS 7 and Custom Errors

Ive got a nice restful service going on (yay openrasta), works well in IIS6 but is giving me default error messages in IIS 7. To turn it off add the following to web.config:

   <system.webServer>
        <httpErrors existingResponse="PassThrough" />
    </system.webServer>

All happy again! I need to look into what other options there are for this setting but it gets me out of a fix for the time being


Nov 25

Nov 3

Oct 26

Oct 20

Safari bug with XmlHTTPRequest authentication: @ symbol

I was testing with safari 5 on Windows and came across the following bug. If the username or password contains an @ symbol, then the xmlHTTPrequest will fail. It wont make a request, instead will generate a blank error.  The solution is to replace @ with %40  (eg. username.replace(“@”,”%40”)) for username and password. This works and the server automatically decodes the username /password back to the original.

Sweet!