我在silverlight页面上有一个超链接按钮。 NavigateUri属性设置为UNC文件夹路径(\\ myserver \ folder)。在Silverlight 4中,我可以单击链接,它将打开文件夹(在提示用户允许访问后)。在Silverlight 5中,单击该链接会产生javascript错误(如下所示)。这是Silverlight 5的新限制吗?有工作吗?
由于
Webpage error details
Message: Unhandled Error in Silverlight Application Attempted to perform an unauthorized operation. at MS.Internal.XcpImports.CheckHResult(UInt32 hr)
at MS.Internal.XcpImports.NavigateToSafeURI(String location, String target, Boolean checkUserInitiatedAction)
at MS.Internal.NavigationHelper.Navigate(Boolean checkUserInitiatedAction)
at System.Windows.Controls.HyperlinkButton.OnClick()
at System.Windows.Controls.Primitives.ButtonBase.OnMouseLeftButtonUp(MouseButtonEventArgs e)
at System.Windows.Controls.Control.OnMouseLeftButtonUp(Control ctrl, EventArgs e)
at MS.Internal.JoltHelper.FireEvent(IntPtr unmanagedObj, IntPtr unmanagedObjArgs, Int32 argsTypeIndex, Int32 actualArgsTypeIndex, String eventName, UInt32 flags)
Line: 1
Char: 1
Code: 0
答案 0 :(得分:0)
这是Silverlight 5中引入的一项新限制。他们修改了安全模型以使其更安全,但也明确允许此行为。
您现在可以在浏览器中运行受信任的应用程序,而不是作为浏览器外的应用程序。您需要将应用程序配置为可信任的OOB应用程序,因为"要求提升信任"和"显示安装菜单"设置是OOB配置的一部分。
要在浏览器受信任的应用程序中启用,您需要在客户端计算机上编辑注册表:
创建/设置 AllowElevatedTrustAppsInBrowser 为1
可以在HKEY_LOCAL_MACHINE\Software\Microsoft\Silverlight\
中找到32位计算机,或HKEY_LOCAL_MACHINE\Software\Wow6432NodeaMicrosoft\Silverlight\
表示64位。
此外,必须使用有效证书对.xap文件进行签名,并且必须安装证书。