based off of pull request 42. Also added a _config.IsSendingCookiesEnabled to turn this on/off from config file.