0

I am on .NET 3.5 and using

client.UploadDataAsync(uri,"POST", array);  

for uploads, and

client.DownloadStringAsync(uri);

for downloads.

Every time I upload, or download it takes forever! When I access the information via browser, it takes milliseconds.

When I do it through code, it takes no less than 10 seconds.

I have tried

WebRequest.DefaultWebProxy = null;

But I see no significant change.

What else can I do to improve speeds? -- Or is there a better approach with async functionality?

Also, because it is still working in the background, what would be a way to cancel all tasks currently being done (downloads, uploads) when my program terminates? FYI I just want a catch-all method that terminates all proccesses.

Note: I cannot upgrade from 3.5

ali.vic
  • 11
  • 4
  • Do you need to view the results? Usually the time is the updating of the VIEW that is taking the time. There may be java code running that is slowing down the process. It is possible in the browser that java is disabled or a different brow – jdweng Jun 29 '20 at 15:27
  • No, I don't need to view the results. This is in C#, I don't "view" anything, it is all code to seriver. – ali.vic Jun 29 '20 at 15:32
  • I would use a sniffer like wireshark or fiddler which will give the time and amount of data. I would compare the headers in the first request between browser and c# code and make c# headers look like browser headers. There could be a lot of differences that would slow down the transfer. I do not want to guess the root cause. – jdweng Jun 29 '20 at 15:47
  • Ah thank you!, I will look into that, do you know of a good sample code I can use? – ali.vic Jun 29 '20 at 16:00
  • Lets first see what the header show. I did something last week at following posting : https://stackoverflow.com/questions/62584587/deserialization-from-rest-api-xml-to-listt-c-sharp/62586060#62586060 – jdweng Jun 29 '20 at 16:14

0 Answers0