I have a json file named test.json in the root of my website. which is hosted on a Windows Server 2012 R2 in IIS version 6.2. the json file is 2698KB. I have written a small C# console application which is very simple it accesses the file and then writes the byte array to a file.
class Program
{
static void Main(string[] args)
{
WebClient client = new WebClient();
byte[] data = client.DownloadData("http://mywebsite/test.json");
File.WriteAllBytes("D:\\test\\download.json", data);
}
}
When I run this exe on my local machine, and then compare the downloaded file with the original file in the website root, the two are identical. But when I run the exe on the server (the same server which is hosting the site) and compare the downloaded file with the original the downloaded file is always corrupted, and each time in a different place or a different way. For example:
Original Json:
"Deleted" : false,
"CreateDate" : "2012-09-04T07:57:41.5947956",
"ModUser" : "CFR",
Corrupt Json:
"Language" : null,
"Dell," Lookup ":null," LanguageId ":1,"
It is just corrupt and makes no sense and cannot be parsed. This functionality was working fine on this website for a long time, and now the files are always corrupt. If I download the json through Internet Explorer it is also corrupt when using the browser on the server. But not from my local machine. I don't know what could be causing this problem. Any help or tips would be really appreciated.