Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

"this file is blocked because it came from another computer" - ajax permission issue

Im fetching a local xml file using jQuery ajax through an html that i download from my site.

The problem is that each and every time the file gets downloaded, the user must right click on it -> properties -> unblock. Otherwise jquery ajax throws a "permission denied" error.

Is there any way to mark the file as trusted or something similar? Should i implement something on the serverside when downloading the file? Or add something on the client side in the saved html file? Thanks in advance.

like image 767
Johan Avatar asked May 10 '12 13:05

Johan


People also ask

How do you fix this file came from another computer and might be blocked?

1] Unblock the file If you wish to open the file, you will have to right-click on the file and open Properties. Under the General tab, towards the bottom you will see classified under Security: This file came from another computer and might be blocked to help protect this computer. Click on Unblock. Click Apply > OK.

How do I unblock a setup file?

Open Microsoft Windows Explorer to locate and right-click the downloaded file, choose Properties from the context menu. Click the Unblock button in the lower right-hand corner of the resulting dialog. Click OK or Apply.


1 Answers

The NTFS file system attache to this file a flag as unsafe. You can use one utility from Sysinternals called Streams to remove this flag. You can download the Streams from:

http://technet.microsoft.com/en-us/sysinternals/bb897440.aspx

Then using the Process class you can run the streams -d <file.xml> command to remove this flag, after you have get the file. How to run it:

Process runcommd = new Process();

runcommd.StartInfo.FileName = "streams";
runcommd.StartInfo.Arguments = " -d \"fullpath\\file.xml\"";

runcommd.StartInfo.UseShellExecute = false;
runcommd.StartInfo.CreateNoWindow = false;

runcommd.StartInfo.RedirectStandardError = true;
runcommd.StartInfo.RedirectStandardOutput = true;
runcommd.StartInfo.RedirectStandardInput = true;

// now run it
runcommd.Start();

// be sure that we end
runcommd.StandardInput.Flush();
runcommd.StandardInput.Close();

The Streams are from MS site, so its official and credible source, and its just a utility that remove this flag from the file. I think that you can do your job.

Related: https://superuser.com/questions/38476/this-file-came-from-another-computer-how-can-i-unblock-all-the-files-in-a

http://www.k9ivb.net/files/This%20file%20came%20from%20another%20computer%20and%20might%20be%20blocked.pdf

like image 73
Aristos Avatar answered Sep 26 '22 13:09

Aristos