简体   繁体   English

从服务器上后面(aspx.cs)的asp.net代码如何确定客户端上是否安装了Silverlight?

[英]From asp.net code behind (aspx.cs) on the server how can I determine if Silverlight is installed on the client?

IIS 6.0 hosting ASP.NET 3.5. IIS 6.0托管ASP.NET 3.5。 From the Visual Studio 2008 aspx code behind (aspx.cs) running on the server I need to determine if Silverlight is installed on the client and if so which version. 从服务器上运行的Visual Studio 2008 aspx代码(aspx.cs)后面,我需要确定客户端上是否安装了Silverlight,以及是否安装了哪个版本。

I know from Java on the client this can be done. 我从客户端上的Java知道可以做到这一点。 That is not what I need. 那不是我所需要的。

I know I can put in a control that will render if Silverlight is installed. 我知道我可以放入一个控件,如果安装了Silverlight,则该控件将呈现。 That is not what I need. 那不是我所需要的。

It seems Silverlight does not add any information to the user-agent string that is sent to the server with every request (by the browser). 似乎Silverlight不会将任何信息添加到随每个请求(通过浏览器)发送到服务器的用户代理字符串中。 So it will probably not be possible to detect Silverlight on the server-side. 因此,可能无法在服务器端检测到Silverlight。

This means, you'll have to detect it on the client-side (using javascript), eg using silverlight.js . 这意味着,您必须在客户端(使用javascript)进行检测,例如使用silverlight.js

The only way to know if a client has something is on the client. 知道客户端是否有东西的唯一方法是在客户端上。 The server really don't know (and don't need to) know nothing about the clients. 服务器真的不知道(也不需要)关于客户端的任何信息。

You could execute the Javascript on client and send the result to the server with ajax if you need to. 您可以在客户端上执行Javascript,然后根据需要使用ajax将结果发送到服务器。

The existence of the Silverlight plug-in and the version is not sent in the request headers to your server. Silverlight插件的存在和版本不会在请求标头中发送到您的服务器。 It does not matter what web server technology your using. 使用哪种Web服务器技术都没有关系。

The only way you can do it is to have some JavaScript or Silverlight on the page that posts back to your server. 唯一的方法是在页面上放一些JavaScript或Silverlight,然后将其发布回服务器。

Why do you feel you can't use on of these techniques? 为什么您觉得无法使用这些技术?

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

相关问题 在aspx.cs(在后面的代码)asp.net中创建RequiredFieldValidator - Make RequiredFieldValidator in aspx.cs (code behind) asp.net 如何将我在 Visual Studio 2019 中的代码从 aspx.vb 转换为 aspx.cs 以创建 asp.net 网站? - how to convert my code behind in visual studio 2019 from aspx.vb to aspx.cs in order to create a asp.net website? 如何在asp.net c#的aspx.cs页面中访问td ID? - How can I access td Id in aspx.cs page of asp.net c#? 如何在 asp.net 的特定 html 标记中显示 aspx.cs 文件的响应? - how can i show response of aspx.cs file in perticular html tag in the asp.net? ASP.NET如何在aspx.cs的Page_Load中使用我的类 - ASP.NET How can I use my class in Page_Load of my aspx.cs 文件后面的aspx.cs代码中的ASP.NET线程安全 - ASP.NET Thread Safety in aspx.cs code behind file 在ASP.NET中将内容(aspx)与代码(aspx.cs)分开 - Separating Content (aspx) from Code (aspx.cs) in ASP.NET ASP.NET参考以服务器aspx.cs服务器代码的形式动态创建了控件 - ASP.NET Reference dynamically created control back in server aspx.cs server code 如何仅从asp.net/c#中的.aspx和.aspx.cs文件创建解决方案 - How to create a solution only from .aspx and .aspx.cs files in asp.net/c# 如何从 C# asp.net 后端(.aspx.cs 文件)中的类(.cs)调用变量 - How to call variables from a class(.cs) in C# asp.net backend (.aspx.cs file)
 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM