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.
Good on you! It works! Thanks heaps…
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.
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.
Thanks for this – it works as advertised. However my file was named msie.inc.php, not msie.php.
Sorry, you’re right. It should be msie.inc.php not msie.php.
Thanks for the fix. You’re a saviour. 😉
Thanks for the help James.
Followed a link from the WordPress forums to your site. It solved my problem with WLW. Thanks for figuring it out!
How can we resolve HTTP 403 Error problem.I mean can u provide me with a crack that can see through the error…
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.
I’ve deactivated Bad Behavior and tried to refresh the theme, but that was no good either 😕
What’s next?
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
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.