Silverlight 4中的Clipboard_AccessNotAllowed错误 [英] Clipboard_AccessNotAllowed error in Silverlight 4

查看:79
本文介绍了Silverlight 4中的Clipboard_AccessNotAllowed错误的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述





我正在使用 Silverlight 4.0 我使用剪贴板(System.Windows)用于从站点复制错误的类。



它在我的机器上工作正常但是当我试图从其他机器访问它时,我得到了以下错误:



Hi,

I am working with Silverlight 4.0 and I have used Clipboard(System.Windows) class for copying error from the site.

It is working fine in my machine but when I am trying to access it from Others machine, I am getting follwing Error :

"

[Clipboard_AccessNotAllowed]<br />
Arguments:<br />
Debugging resource strings are unavailable. Often the key and arguments provide sufficient information to diagnose the problem. See http://go.microsoft.com/fwlink/?linkid=106663&Version=4.0.60310.0&File=System.Windows.dll&Key=Clipboard_AccessNotAllowed"





我的代码如下:





My code is as below :

private void SetMessageToClipboard(string sMessage)
        {
            try
            {
                Clipboard.SetText(sMessage);
            }
            catch (Exception ex)
            {
                MessageBox.Show(ex.Message);
            }
        }





在Silverlight弹出窗口中选择记住我的答案后,此错误将消失。



它与ClientPolicy.XML文件有关吗?我没有添加它。但我在ClientPolicy.XML中找不到任何对我有帮助的东西。





请建议。



This error will be disappeared once you select 'Remember my answer' in popup of Silverlight.

Is it related to ClientPolicy.XML file? I have not added it. But I have not found anything in ClientPolicy.XML which can be helpful for me.


Please suggest.

推荐答案

我怀疑你可以访问代码未在本地运行时的剪贴板。复制客户端剪贴板肯定是一种潜在的恶意行为?
I doubt you can access the clipboard when your code is not running locally. Copying the clients clipboard is surely a potentially hostile behaviour ?


Silverlight 4支持剪贴板。您需要通过用户初始化操作执行此操作。

请参阅这里 [ ^ ]。
Silverlight 4 has support to the Clipboard. You need to do this via a user initialized action.
See here[^].


它非常简单:



转到开始 - >所有程序 - > Microsoft Silverlight-> Microsoft Silverlight(点击它)

这将为您打开Silverlight。



现在转到权限选项卡。您将在此处查看剪贴板并获得Deny许可。

单击允许 - >单击确定。



重新启动您的应用程序,现在您的Silverlight应用程序应该可以访问剪贴板。



享受编码,

Ajay
Its rather very simple:

Go to Start-> All Programs->Microsoft Silverlight-> Microsoft Silverlight(Click it)
This will open Silverlight for you.

Now go to Permissions Tab. You will See clipboard here with permission as Deny.
Click Allow -> Click OK.

Restart your Application and now your Silverlight application should have access to clipboard.

Enjoy Coding,
Ajay


这篇关于Silverlight 4中的Clipboard_AccessNotAllowed错误的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆