Silverlight专题(6)-自定义提示Plugin安装信息
问题:
Silverlight 2 RC0虽然发布了
但是由于其只是针对开发人员的版本
所以微软没有提供对这个版本安装的正确提示信息
也就是说别人如果访问您用RC0编译的网站
将得到错误的信息,要求他们安装Silverlight 2 Beta2
而不是RC0的Runtime
所以我们非常有必要自定义安装信息
解决方案:
打开要加载Silverlight程序的asp.net页面
页面代码类似如下(RC0的版本号更新到了2.0.30923.0):
<%@ Page Language="C#" AutoEventWireup="true" %>
<%@ Register Assembly="System.Web.Silverlight" Namespace="System.Web.UI.SilverlightControls"
TagPrefix="asp" %>
<!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" style="height:100%;">
<head runat="server">
<title>ReleaseTest</title>
</head>
<body style="height:100%;margin:0;">
<form id="form1" runat="server" style="height:100%;">
<asp:ScriptManager ID="ScriptManager1" runat="server"></asp:ScriptManager>
<div style="height:100%;">
<asp:Silverlight ID="Xaml1" runat="server" Source="~/ClientBin/ReleaseTest.xap" MinimumVersion="2.0.30923.0" Width="100%" Height="100%"/>
</div>
</form>
</body>
</html>
<%@ Register Assembly="System.Web.Silverlight" Namespace="System.Web.UI.SilverlightControls"
TagPrefix="asp" %>
<!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" style="height:100%;">
<head runat="server">
<title>ReleaseTest</title>
</head>
<body style="height:100%;margin:0;">
<form id="form1" runat="server" style="height:100%;">
<asp:ScriptManager ID="ScriptManager1" runat="server"></asp:ScriptManager>
<div style="height:100%;">
<asp:Silverlight ID="Xaml1" runat="server" Source="~/ClientBin/ReleaseTest.xap" MinimumVersion="2.0.30923.0" Width="100%" Height="100%"/>
</div>
</form>
</body>
</html>
<asp:Silverlight .../>就是用来加载Silverlight应用程序的,有点而类似flash插件
<asp:Silverlight .../>下面有个
<PluginNotInstalledTemplate/>
用来自定义Runtime没有安装的状态下的提示信息
微软给的默认的情况如下,相信大家都比较熟悉了
我们可以自定义安装代码如下:
<asp:Silverlight ID="Xaml1" runat="server" Source="~/ClientBin/ReleaseTest.xap" MinimumVersion="2.0.30923.0" Width="100%" Height="100%">
<PluginNotInstalledTemplate>
请卸载已经安装的Silverlight的所有版本,之后安装<a href="http://go.microsoft.com/fwlink/?linkid=129011">
<img src="http://go.microsoft.com/fwlink/?LinkId=108181" alt="Get Microsoft Silverlight RC0" style="border-style: none"/></a>
才能访问本网站
</PluginNotInstalledTemplate>
</asp:Silverlight>
<PluginNotInstalledTemplate>
请卸载已经安装的Silverlight的所有版本,之后安装<a href="http://go.microsoft.com/fwlink/?linkid=129011">
<img src="http://go.microsoft.com/fwlink/?LinkId=108181" alt="Get Microsoft Silverlight RC0" style="border-style: none"/></a>
才能访问本网站
</PluginNotInstalledTemplate>
</asp:Silverlight>
在这里我设置了安装地址为Silverlight 2 RC0的Runtime : http://go.microsoft.com/fwlink/?linkid=129011
这样你的老板或者同事就不会频繁的来问你为什么我已经安装了Silverlight了,但是还是访问不了你的网站了
我们的自定义安装界面如下(没有做美化处理,大家如果要使用,可能还需要让美工帮忙处理下):>
代码下载地址如下:
分类:
Silverlight
【推荐】国内首个AI IDE,深度理解中文开发场景,立即下载体验Trae
【推荐】编程新体验,更懂你的AI,立即体验豆包MarsCode编程助手
【推荐】抖音旗下AI助手豆包,你的智能百科全书,全免费不限次数
【推荐】轻量又高性能的 SSH 工具 IShell:AI 加持,快人一步
· 从 HTTP 原因短语缺失研究 HTTP/2 和 HTTP/3 的设计差异
· AI与.NET技术实操系列:向量存储与相似性搜索在 .NET 中的实现
· 基于Microsoft.Extensions.AI核心库实现RAG应用
· Linux系列:如何用heaptrack跟踪.NET程序的非托管内存泄露
· 开发者必知的日志记录最佳实践
· TypeScript + Deepseek 打造卜卦网站:技术与玄学的结合
· Manus的开源复刻OpenManus初探
· AI 智能体引爆开源社区「GitHub 热点速览」
· C#/.NET/.NET Core技术前沿周刊 | 第 29 期(2025年3.1-3.9)
· 从HTTP原因短语缺失研究HTTP/2和HTTP/3的设计差异