Windows Live Writer and 403 Forbidden error

At any given time, I have at least 2 blog posts in draft form that I’m waiting to put the finishing touches on before publishing. I wasn’t originally a fan of using a rich blog client since I always wanted to roam the drafts and work on them from whatever computer I happen to be at. When Windows Live Writer (WLW) was first released, like a good Microsoft cog, I jumped on it to give it a try. Truthfully, I already had a huge bias against it due to my love for the roaming drafts.

 

However, to my surprise, I really, really liked Windows Live Writer. It made many of the tasks I struggle with regularly in authoring my posts, like embedding images that aren’t already remotely hosted. Windows Live Writer allowed me to author my posts very intuitively by enabling me to insert local images while I’m writing, and uploading them after I elect to publish the post. The post is then modified to have the image reference the new remote location.

 

Ever since falling in love with WLW, I was hoping they would release an update to fix some bugs I noticed as well as add new features. My wish came true on May 30th when The WLW team announced v2 was available for immediate download.

 

After eagerly downloading and installing it, I ran into a huge problem — I couldn’t even connect to my blog. I kept getting an obscure errror message that claimed I was getting a 403 Forbidden HTTP status code from the XML-RPC interface. I was able to hit the file directly without any trouble and verified that the file permissions were indeed correct. I was stumped. I did a web search and surprisingly I couldn’t find any information on it.

 

I emailed the Program Manager who works on the WLW team (perks of working at Microsoft I guess), and after a few emails, I was told to check if I had the Bad Behavior plugin installed (I do). It seems there is a bug in WLW v2 that makes it incompatible with that plugin.

 

The problem is documented by James McKay, who has a very simple fix. You just have to change the msie.inc.php file for the Bad Behavior plugin from this:

if (!array_key_exists('Accept', $package['headers_mixed'])) {
   return "17566707";
} 

to this:

if (strpos($package['headers_mixed']['User-Agent'], "Windows Live Writer")

    === FALSE && !array_key_exists('Accept', $package['headers_mixed'])) {

return "17566707";

}

After making this quick and painless change, WLW works now with my blog once again. Yipee!