我们正在尝试使 Silverlight 5 可信应用程序能够在浏览器中运行。
目标:访问 MyDocuments 中的 MyVideo 文件夹,通常可以使用 Silverlight 4 版本中的浏览器外提升设置来访问该文件夹。
软件:Silverlight 5 和 VS2010 Express。
问题:使用“提升权限”设置访问“我的文档”文件夹中的“我的视频”文件夹时,VS2010 显示安全异常。
其他设置:
- 提升权限所需的注册表项 链接
- 使用自签名证书对 XAP 进行签名 链接
示例代码:
if (!Application.Current.HasElevatedPermissions)
{
MessageBox.Show("No elevated permission set");
}
String myVideoPath =
//[breakpoint set Here]
Environment.GetFolderPath(Environment.SpecialFolder.MyVideos).ToString();
VS2010 中在断点处捕获的安全异常:
[文件安全状态_操作不允许]
论据:
调试资源字符串不可用。通常是关键和论据
提供足够的信息来诊断问题。参见
是否还有更多设置可以使用纯浏览器内 Silverlight 5 应用程序访问 MyVideo 文件夹?
发现我们仍然需要临时设置“浏览器外”设置,以便在浏览器中作为受信任的应用程序运行。
欢迎任何有助于解决安全异常的指示!
TIA
We're trying to Enable Silverlight 5 Trusted Applications to Run within the Browser.
Goal : Access the MyVideo folder within MyDocuments which is usually accessible using Out of Browser Elevated settings in Silverlight 4 version.
Software : Silverlight 5 with VS2010 Express.
Issue : VS2010 shows an security exception while accessing the "My Videos" folder within the "My Documents" folder with "Elevated Permissions" setting.
Other Settings :
- The Registry entry required to elevating the permissions done from this link
- Signing of XAP using self signed certificate done from this link
Sample Code :
if (!Application.Current.HasElevatedPermissions)
{
MessageBox.Show("No elevated permission set");
}
String myVideoPath =
//[breakpoint set Here]
Environment.GetFolderPath(Environment.SpecialFolder.MyVideos).ToString();
Security exception trapped @ breakpoint in VS2010 :
[FileSecurityState_OperationNotPermitted]
Arguments:
Debugging resource strings are unavailable. Often the key and arguments
provide sufficient information to diagnose the problem. See
Are there any more settings to be able to access the MyVideo folder using a pure In Browser Silverlight 5 application ?
Have found that the we still require to temporarily set the "Out of browser" setting in order to run In browser as a Trusted Application.
Any pointers that would help resolve the security exception seen are welcome !
TIA
发布评论
评论(1)
我还发现您需要选中
Enable running application out of browser
才能运行将访问文件系统的浏览器内应用程序。我相信这只是 Visual Studio 中的测试版用语,最终会更新。请参阅:
http://mtaulty.com/CommunityServer/blogs/mike_taultys_blog/archive/2011/04/27/silverlight-5-beta-rough-notes-trusted-apps-in-the-browser.aspx< /a>
I also found that you will need to leave
Enable running application out of browser
checked in order to run an in-browser app that will access the file system. I believe this is simply beta verbage in Visual Studio that will eventually be updated.See:
http://mtaulty.com/CommunityServer/blogs/mike_taultys_blog/archive/2011/04/27/silverlight-5-beta-rough-notes-trusted-apps-in-the-browser.aspx