If the content is larger than 32k, the value is negative. Change ContentLength to "unsigned long" for larger content.