Im fetching a local xml file using jQuery ajax through an html that i download from my site.
我使用jQuery ajax通过从站点下载的html获取本地xml文件。
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.
问题是每次下载文件时,用户必须右键单击它——>属性——> unblock。否则,jquery ajax抛出一个“拒绝权限”错误。
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.
有什么方法可以将文件标记为可信的或类似的?在下载文件时,我是否应该在服务器端实现什么?或者在保存的html文件中在客户端添加一些东西?提前谢谢。
3 个解决方案
#1
6
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:
NTFS文件系统专员将此文件标记为不安全。您可以使用Sysinternals(称为Streams)中的一个实用程序来删除此标志。你可从以下网站下载:
http://technet.microsoft.com/en-us/sysinternals/bb897440.aspx
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:
然后使用流程类,您可以运行streams -d <文件。在您获得文件之后,xml> 命令删除此标志。如何运行:
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.
流来自于MS站点,因此它的官方和可信的源代码,并且它只是一个从文件中删除这个标志的实用程序。我认为你能做好你的工作。
相关: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
#2
1
@Aristos is spot-on on the alternate file stream issue, however this can be done without the use of an external EXE (streams.exe). For anyone else looking at this later on you can run the following command to empty the alternate file stream (AFS):
@Aristos对其他文件流问题都很守口如瓶,但是可以不使用外部EXE (streams.exe)。对于任何稍后查看此内容的人,您都可以运行以下命令来清空备用文件流(AFS):
echo. > my_blocked_file.zip:Zone.Identifier
Assuming the file name of my_blocked_file.zip this will empty the content of the AFS. Also, you can issue dir /r
to list AFS's and notepad my_blocked_file.zip:Zone.Identifier
to actually edit the them.
假设my_blocked_file的文件名。压缩这个将清空AFS的内容。此外,还可以发出dir /r来列出AFS和notepad my_blocked_file.zip:Zone。标识符来实际编辑它们。
This is what an Internet Zone Identifier looks like:
Internet Zone标识符是这样的:
[ZoneTransfer]
ZoneId=3
Additional reading on these streams: http://msdn.microsoft.com/en-us/library/ff469212(v=prot.10)
这些流的附加阅读:http://msdn.microsoft.com/en-us/library/ff469212(v=prot.10)
and the respective security zones are:
各安全区分别为:
- Intranet: ZoneId=1
- 内部网:ZoneId = 1
- Trusted Site: ZoneId=2
- 受信任的站点:ZoneId = 2
- Internet: ZoneId=3
- 互联网:ZoneId = 3
- Restricted Site: ZoneId=4
- 受限制的站点:ZoneId = 4
Also, IE only seems to read the AFS when you open/close the session so you couldn't change a stream and then just refresh, you'd need to create a new IE instance to re-read the new AFS.
此外,IE似乎只在打开/关闭会话时读取AFS,这样您就不能更改流,然后只需刷新,您需要创建一个新的IE实例来重新读取新的AFS。
#3
0
Give this a try. Open up regedit, and look for the following key/value:
试试这个办法。打开regedit,查找以下键/值:
HKEY_CURRENT_USER\Software\Microsoft\Windows\CurrentVersion\Policies\Attachments\SaveZoneInformation
微软HKEY_CURRENT_USER \ Software \ \ Windows \ CurrentVersion \ \附件\ SaveZoneInformation政策
Set this value to 1 and see if the problem persists. Might have to log out and back in to be sure, as its an HKCU value. You still might get this message once more, but if you unblock it again with this value in place, it might prevent it from happening again.
将此值设置为1,并查看问题是否仍然存在。可能需要退出和返回才能确定,因为它是HKCU的值。您可能仍然会再次获得此消息,但是如果您使用这个值重新解除它的阻塞,它可能会阻止它再次发生。
#1
6
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:
NTFS文件系统专员将此文件标记为不安全。您可以使用Sysinternals(称为Streams)中的一个实用程序来删除此标志。你可从以下网站下载:
http://technet.microsoft.com/en-us/sysinternals/bb897440.aspx
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:
然后使用流程类,您可以运行streams -d <文件。在您获得文件之后,xml> 命令删除此标志。如何运行:
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.
流来自于MS站点,因此它的官方和可信的源代码,并且它只是一个从文件中删除这个标志的实用程序。我认为你能做好你的工作。
相关: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
#2
1
@Aristos is spot-on on the alternate file stream issue, however this can be done without the use of an external EXE (streams.exe). For anyone else looking at this later on you can run the following command to empty the alternate file stream (AFS):
@Aristos对其他文件流问题都很守口如瓶,但是可以不使用外部EXE (streams.exe)。对于任何稍后查看此内容的人,您都可以运行以下命令来清空备用文件流(AFS):
echo. > my_blocked_file.zip:Zone.Identifier
Assuming the file name of my_blocked_file.zip this will empty the content of the AFS. Also, you can issue dir /r
to list AFS's and notepad my_blocked_file.zip:Zone.Identifier
to actually edit the them.
假设my_blocked_file的文件名。压缩这个将清空AFS的内容。此外,还可以发出dir /r来列出AFS和notepad my_blocked_file.zip:Zone。标识符来实际编辑它们。
This is what an Internet Zone Identifier looks like:
Internet Zone标识符是这样的:
[ZoneTransfer]
ZoneId=3
Additional reading on these streams: http://msdn.microsoft.com/en-us/library/ff469212(v=prot.10)
这些流的附加阅读:http://msdn.microsoft.com/en-us/library/ff469212(v=prot.10)
and the respective security zones are:
各安全区分别为:
- Intranet: ZoneId=1
- 内部网:ZoneId = 1
- Trusted Site: ZoneId=2
- 受信任的站点:ZoneId = 2
- Internet: ZoneId=3
- 互联网:ZoneId = 3
- Restricted Site: ZoneId=4
- 受限制的站点:ZoneId = 4
Also, IE only seems to read the AFS when you open/close the session so you couldn't change a stream and then just refresh, you'd need to create a new IE instance to re-read the new AFS.
此外,IE似乎只在打开/关闭会话时读取AFS,这样您就不能更改流,然后只需刷新,您需要创建一个新的IE实例来重新读取新的AFS。
#3
0
Give this a try. Open up regedit, and look for the following key/value:
试试这个办法。打开regedit,查找以下键/值:
HKEY_CURRENT_USER\Software\Microsoft\Windows\CurrentVersion\Policies\Attachments\SaveZoneInformation
微软HKEY_CURRENT_USER \ Software \ \ Windows \ CurrentVersion \ \附件\ SaveZoneInformation政策
Set this value to 1 and see if the problem persists. Might have to log out and back in to be sure, as its an HKCU value. You still might get this message once more, but if you unblock it again with this value in place, it might prevent it from happening again.
将此值设置为1,并查看问题是否仍然存在。可能需要退出和返回才能确定,因为它是HKCU的值。您可能仍然会再次获得此消息,但是如果您使用这个值重新解除它的阻塞,它可能会阻止它再次发生。