silverlight 用户浏览器未安装SL插件问题
1.在Silverlight启动页面
<%@ Page Language="C#" AutoEventWireup="true" %> <!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head runat="server">
<title>SilverlightApplication9</title>
<style type="text/css">
html, body {
height: %;
overflow: auto;
} body {
padding: ;
margin: ;
} #silverlightControlHost {
height: %;
text-align: center;
}
</style>
<script type="text/javascript" src="SplashScreen.js"></script>
<script type="text/javascript" src="Silverlight.js"></script>
<script type="text/javascript">
function onSilverlightError(sender, args) {
var appSource = "";
if (sender != null && sender != ) {
appSource = sender.getHost().Source;
} var errorType = args.ErrorType;
var iErrorCode = args.ErrorCode; if (errorType == "ImageError" || errorType == "MediaError") {
return;
} var errMsg = "Silverlight 应用程序中未处理的错误 " + appSource + "\n"; errMsg += "代码: " + iErrorCode + " \n";
errMsg += "类别: " + errorType + " \n";
errMsg += "消息: " + args.ErrorMessage + " \n"; if (errorType == "ParserError") {
errMsg += "文件: " + args.xamlFile + " \n";
errMsg += "行: " + args.lineNumber + " \n";
errMsg += "位置: " + args.charPosition + " \n";
}
else if (errorType == "RuntimeError") {
if (args.lineNumber != ) {
errMsg += "行: " + args.lineNumber + " \n";
errMsg += "位置: " + args.charPosition + " \n";
}
errMsg += "方法名称: " + args.methodName + " \n";
} throw new Error(errMsg);
}
</script>
</head>
<body>
<form id="form1" runat="server" style="height: 100%">
<div id="silverlightControlHost">
<object data="data:application/x-silverlight-2," type="application/x-silverlight-2" width="100%" height="100%">
<param name="source" value="ClientBin/SilverlightApplication9.xap" />
<param name="onError" value="onSilverlightError" />
<param name="initParams" value="<%= String.Format("{}={},{}={}","ClientIP", Request.UserHostAddress,"ClientName",Request.UserHostName) %>" />
<param name="background" value="white" />
<param name="minRuntimeVersion" value="5.0.61118.0" />
<param name="autoUpgrade" value="true" />
<a href="/DownloadSilverlight.aspx" style="text-decoration: none">
<img src="/Img/SLMedallion_CHS.png" alt="获取 Microsoft Silverlight"
style="border-style: none" />
</a>
</object>
<iframe id="_sl_historyFrame" style="visibility: hidden; height: 0px; width: 0px; border: 0px"></iframe>
</div>
</form>
</body>
</html>
2.在Silverlight.web服务端添加要显示的图片及路径、silverlight插件的两个版本(32位、64位)
3.在silverlight.web服务端添加DownloadSilverlight.aspx项
using System;
using System.Collections.Generic;
using System.Linq;
using System.Web;
using System.Web.UI;
using System.Web.UI.WebControls; namespace SilverlightApplication9.Web
{
public partial class DownloadSilverlight : System.Web.UI.Page
{
protected void Page_Load(object sender, EventArgs e)
{
//string info = "客户端IP:" + Page.Request.UserHostAddress;
//info += "<br/>用户信息:" + Page.User;
//info += "<br/>服务器电脑名称:" + Page.Server.MachineName;
//info += "<br/>当前用户电脑名称:" + System.Net.Dns.GetHostName();
//info += "<br/>当前电脑名:" + System.Environment.MachineName;
//info += "<br/>当前电脑所属网域:" + System.Environment.UserDomainName;
//info += "<br/>当前电脑用户:" + System.Environment.UserName;
//info += "<hr/>";
//info += "<br/>浏览器类型:" + Request.Browser.Browser;
//info += "<br/>浏览器标识:" + Request.Browser.Id;
//info += "<br/>浏览器版本号:" + Request.Browser.Version;
//info += "<br/>浏览器是不是测试版本:" + Request.Browser.Beta;
////info += "<br/>浏览器的分辨率(像素):" + Request["width"].ToString() + "*" + Request["height"].ToString();//1280/1024
//info += "<hr/>";
//info += "<br/>客户端的操作系统:" + Request.Browser.Platform;
//info += "<br/>是不是win16系统:" + Request.Browser.Win16;
//info += "<br/>是不是win32系统:" + Request.Browser.Win32;
//Response.Write(info); //int loop1, loop2;
//NameValueCollection coll; //// Load ServerVariable collection into NameValueCollection object.
//coll = Request.ServerVariables;
//// Get names of all keys into a string array.
//String[] arr1 = coll.AllKeys;
//for (loop1 = 0; loop1 < arr1.Length; loop1++)
//{
// Response.Write("Key: " + arr1[loop1] + "<br>");
// String[] arr2 = coll.GetValues(arr1[loop1]);
// for (loop2 = 0; loop2 < arr2.Length; loop2++)
// {
// Response.Write("Value " + loop2 + ": " + Server.HtmlEncode(arr2[loop2]) + "<br>");
// }
//}
//Response.End();
if (Request.ServerVariables["HTTP_USER_AGENT"].ToString().Contains("WOW64"))
{
Response.Redirect("/Silverlight/Silverlight_x64.exe");
}
else
{
Response.Redirect("/Silverlight/Silverlight.exe");
}
}
}
}
silverlight 用户浏览器未安装SL插件问题的更多相关文章
- 浏览器未安装flash插件,js判断直接去官网安装
近期做了个活动页,里面根据需求插入了阿里云的视频,常见的浏览器都支持包括低版本的. 由于浏览器的更新换代很多版本放弃了flash的插件安装,火狐就是其中之一. 未安装flash的浏览器如果打开这个链接 ...
- js判断浏览器是否安装Flash插件,并提示安装或开启
var flashChecker = function() { var hasFlash = 0; //是否安装了flash var flashVersion = 0; //flash版本 if(do ...
- adblockTester通过js检测用户浏览器是否安装了AdBlock
adblockTester 简介 首先有必要介绍一下AdBlock,它是一款知名网页广告屏蔽插件,在各大主流浏览器上均有AdBlock插件. AdBlock为用户带来了一片蓝天,却苦了站长,尤其是苦逼 ...
- Postman Google浏览器离线安装Postman插件
Google浏览器离线安装Postman插件 by:授客 QQ:1033553122 解决无法通打开谷歌web商店安装Postman插件的问题,文章参考网络. 测试环境:ChromeStandalon ...
- JS判断浏览器是否安装flash插件
1.直接判断是否有flash插件 var myFlash = (function(){ if(typeof window.ActiveXObject != "undefined") ...
- 如何用js检查浏览器是否安装flash插件
<script type="text/javascript" language="JavaScript"> //Powered By smvv @h ...
- 网页如何检查浏览器是否安装flash插件
如果页面需要加载flash插件并且需要提示用户flash下载,这里有个官方很好的js文件只要引用就可以实现 //v1.7 // Flash Player Version Detection // De ...
- Chrome浏览器商店安装的插件保存到本地
Chrome自67版本开始,不能从第三方下载插件拖动安装,要么就是以前的方法安装修改为zip格式,会有报错(报错如下图),强迫症肯定忍不了报错的:按照网上说法,是第三方插件的压缩算法和Chrome商店 ...
- Silverlight 用户代码未处理 TypeLoadException
在Silverlight中动态创建Enum时,多次调用改方法出现上图所示错误,后来发现定义名称都是一样的, 在程序中声明全局变量去区别就可以了. int num = 1; private Type C ...
随机推荐
- 算法总结—深度优先搜索DFS
深度优先搜索(DFS) 往往利用递归函数实现(隐式地使用栈). 深度优先从最开始的状态出发,遍历所有可以到达的状态.由此可以对所有的状态进行操作,或列举出所有的状态. 1.poj2386 Lake C ...
- IOS UIwebView 加载网络图片 使用相对地址
方法一: 在html文件内直接使用file:///user//xx//image.png的绝对路径 注:这样可以显示图片,但是如果在程序目录修改,图片就不能显示 方法二: 在html使用占位符,如:在 ...
- uiview 的transitionWithView 方法使用
-(void)touchesBegan:(NSSet *)touches withEvent:(UIEvent *)event { [UIView transitionWithView:_imageV ...
- 【Android 界面效果20】Android GradientDrawable类的详解,设置activity的背景颜色渐变效果
看到这个例子的标题RoundRects,我的第一感觉是介绍RoundRectShape, 打开例子看了代码却是使用GradientDrawable来实现的. GradientDrawable 支持使用 ...
- cent os 6 安装 nginx
cent os 6 默认的库是没有nginx的,所以直接 yum install nginx不行. 解决办法: $ wget http://nginx.org/packages/centos/6/no ...
- MySQL中/*!40100注释
MySQL中的注释 MySQL中的注释有三种: # 注释内容 -- 注释内容 /* 注释内容*/ 但是,在导出的SQL文件中,也会看到类似如下内容的注释: CREATE DATABASE `blog` ...
- 转: 在线office的协作工具列表
产品完备性.协作功能.功能完备性对比 <img src="https://pic2.zhimg.com/af14a86eedcb93962e41e47788de5989_b.p ...
- Dijkstra最短路径算法
#include <iostream> #include <vector> #include <cstring> #include <cstdio> # ...
- 基于JQuery的渐隐渐现轮播
<div id="ads"> <div> <!--轮播图片--> <ul> <li><a href="# ...
- CSS盒模型简单用法
1.盒模型 margin:外边距: margin-top /margin-right/margin-bottom/margin-left; 或者 margin:top right bottomleft ...