最新下载
热门教程
- 1
- 2
- 3
- 4
- 5
- 6
- 7
- 8
- 9
- 10
防止silverlight application被别人引用
时间:2011-01-10 编辑:简简单单 来源:一聚教程网
在app.xaml.cs的application_startup中加入:
if (!app.current.host.settings.enablehtmlaccess)
throw new exception("当前应用程序未允许与dom通信");
string htmlurl = system.windows.browser.htmlpage.document.documenturi.tostring();
if (!htmlurl.equals("http://foo.com/mypage.html"))
throw new exception("您无权使用该应用程序");其中的http://foo.com/mypage.html就是你希望当前silverlight应用程序宿主的页面地址。这样结合防止frame就可以有效防止别人引用你的劳动成果啦。
最后看一下settings中的属性,
public sealed class settings {
public settings();
public bool enableautozoom { get; set; }
public bool enablecachevisualization { get; set; }
public bool enableframeratecounter { get; set; }
public bool enablegpuacceleration { get; }
public bool enablehtmlaccess { get; }
public bool enableredrawregions { get; set; }
public int maxframerate { get; set; }
public bool windowless { get; }
}他们分别对应初始化silverlight(js控制)时的设置。如果我们要使用host的相关属性、控制dom、与js通信,那么enablehtmlaccess 必须为true。
相关文章
- C#复制数组的两种方式及效率比较解读 10-24
- ASP.NET Identity用法解析 10-24
- ASP.NET MVC使用Identity增删改查用户介绍 10-24
- C语言中atoi函数模拟实现介绍 10-18
- .Net反向代理组件Yarp用法介绍 10-10
- .NET使用YARP通过编码方式配置域名转发实现反向代理教程 10-10