[英]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.