سؤال

I have a script that was working for quite some time:

var fso = new ActiveXObject('Scripting.FileSystemObject');
var xmlhttp=new ActiveXObject("microsoft.xmlhttp");
xmlhttp.open("GET", "http://myurl.csv", false);
xmlhttp.send();
var data=xmlhttp.responsetext;

dt = new Date();
month = dt.getMonth() +1
date = dt.getDate()
year = dt.getFullYear()

var fileloc = "\\\\fs1\\myshare$\\myfolder\\" + "my_query_export" + "-" + month + "-" + date + "-" + year + ".csv"
var file = fso.CreateTextFile(fileloc,true);
file.writeLine(data);
file.close();

Recently, however, after executing this script the downloaded file contains this:

If you opened this file and can see this text, then you've probably tried to download a file using the 'save target as' option in the context menu when right clicking the object. Since McAfee Web Gateway is used for virus scanning your browser is redirected to a page that will show the download progress, and by choosing the 'save target as' option you were saving this progress page. To avoid this situation please use a simple click with the left mouse button to download the object. This will correctly redirect your browser to display the download progress and allow you to save the desired object.

How can I revise this code to download and save the CSV instead of this text?

هل كانت مفيدة؟

المحلول

Finally resolved this!

The key was to switch from HTTP to HTTPS and install the website certificate to the Trusted Root Certification Authorities store.

مرخصة بموجب: CC-BY-SA مع الإسناد
لا تنتمي إلى StackOverflow
scroll top