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");
}
}
}
}

最新文章

  1. 使用CSS3制作三角形小图标
  2. git config命令使用
  3. USACO GCD Extreme(II)
  4. JS获取字符串实际长度(包含汉字)
  5. TransactionScope 事务使用说明
  6. 机器学习(Machine Learning)&amp;深度学习(Deep Learning)资料
  7. 关于用Max导出Unity3D使用的FBX文件流程注解
  8. ThreadLocal 设计模式浅谈
  9. php编译安装configure完全配置够日常所用功能
  10. FAT16文件系统简介
  11. Table显示边框
  12. Hibernate Dialect must be explicitly set
  13. 1.Nginx服务应用
  14. http转https实战教程iis7.5
  15. django apscheduler在特定时间执行一次任务(run at a specify time only once)
  16. scanf函数的返回值
  17. int 转double , 转float
  18. Python:Day21
  19. CentOS7装Tomcat
  20. EF 数据版本号,处理具体使用方法 RowVersion / Timestamp 使用方法。进行自动处理并发修改

热门文章

  1. .NET 托管堆和垃圾回收
  2. sort() 方法用于对数组的元素进行排序
  3. 通过layer的contents属性来实现uiimageview的淡入切换
  4. Unity3d之Shader编程:子着色器、通道与标签的写法 &amp; 纹理混合
  5. Ubuntu/Debian 安装lxml的正确方式
  6. My Linux API
  7. 第四节 数据格式化和ModelAttribute注解的介绍
  8. Python时间,日期,时间戳之间转换
  9. JQuery Validate验证显示错误提示位置
  10. Linux之zsh