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

Bad Behavior does not like Windows Live Writer

There is a bug in the newly released Windows Live Writer beta 2 that causes it to choke if you are also using Bad Behavior on your blog.

I first discovered this when I installed it yesterday to check it out. When it refused to update the theme from my blog, I wondered at first if there was a problem with my custom theme, but then half an hour later I looked at my home page again to find that all the comments on my blog had closed. A quick investigation showed that Bad Behavior had been choking on the requests from Windows Live Writer and logging the failed attempts, which were then being picked up by my new plugin, Three Strikes and You’re Out.

It turns out that the problem stems from the fact that Bad Behavior expects Internet Explorer to include an “Accept” header with every HTTP request, and if it gets something that claims to be Internet Explorer yet doesn’t match up to its expectation, it throws an error.

Fortunately, it is not too difficult to fix this, though you do need to tweak the code base of Bad Behavior. Open the file msie.php in the bad-behavior subdirectory of your Bad Behavior plugin and find the lines which say:

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

Change this to read as follows:

if (strpos($package['headers_mixed']['User-Agent'], "Windows Live Writer")
    === FALSE && !array_key_exists('Accept', $package['headers_mixed'])) {
    return "17566707";

You should then be able to use Windows Live Writer on your blog once again, without losing the protection offered by the Bad Behavior plugin.

7 trackbacks:


  • # Reply from Alpesh Nakar at 13:33 on 18 Jun 2007

    Good on you! It works! Thanks heaps…

  • # Reply from Trevin at 20:00 on 21 Jun 2007

    I’ve been going crazy trying to figure out what was wrong with my wordpress setup. I thought it was some weird permission error on my webhosting side. Thanks for posting this up.

  • # Reply from Mike Torrence at 03:50 on 25 Jun 2007

    Any ideas if you get this 403 error and you do NOT have the bad behavior plugin? My wife posted using Live Writer just 2 days ago and now I’m getting 403 errors.

  • # Reply from Chris Webb at 14:20 on 27 Jun 2007

    Thanks for this – it works as advertised. However my file was named msie.inc.php, not msie.php.

  • # Reply from James at 14:36 on 27 Jun 2007

    Sorry, you’re right. It should be msie.inc.php not msie.php.

  • # Reply from John A Thomson at 02:44 on 12 Jul 2007

    Thanks for the fix. You’re a saviour. 😉

  • # Reply from Peta at 12:57 on 14 Aug 2007

    Thanks for the help James.

  • # Reply from Chris Harrison at 09:37 on 21 Aug 2007

    Followed a link from the WordPress forums to your site. It solved my problem with WLW. Thanks for figuring it out!

  • # Reply from Karthik Somanchi at 02:53 on 1 Sep 2007

    How can we resolve HTTP 403 Error problem.I mean can u provide me with a crack that can see through the error…

  • # Reply from Leo F. Swiontek at 08:15 on 31 Mar 2008

    I’ve been going crazy trying to figure out what was wrong with my wordpress setup. I thought it was some weird permission error on my webhosting side. Thanks for posting this up.

  • # Reply from Family Matters at 03:17 on 11 Jun 2009

    I’ve deactivated Bad Behavior and tried to refresh the theme, but that was no good either 😕
    What’s next?

  • # Reply from Leinad Mahdeen at 16:07 on 3 Sep 2009

    Please give me step by step instructions how to do this solve this problem.
    I have a Windows XP computer. With Internet Explorer 8. If that will help.
    Thank you

  • # Reply from James at 20:34 on 3 Sep 2009

    Unfortunately I can’t provide any further help or technical support on this issue. This bug was fixed in beta 3 of Windows Live Writer, and I have not had any problems with either it or later versions of Bad Behaviour for quite some time.

    I can therefore only assume that anyone still experiencing problems here is having a different problem that does not affect me.

    If this is the case for you, your best bet is to ask on either the WordPress website or superuser.com.

Comments are closed.