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

只谈情不闲聊 提交于 2019-12-24 23:23:24

问题


IIS 6.0 hosting 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.

I know from Java on the client this can be done. That is not what I need.

I know I can put in a control that will render if Silverlight is installed. That is not what I need.


回答1:


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). So it will probably not be possible to detect Silverlight on the server-side.

This means, you'll have to detect it on the client-side (using javascript), e.g. using silverlight.js.




回答2:


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.




回答3:


The existence of the Silverlight plug-in and the version is not sent in the request headers to your server. It does not matter what web server technology your using.

The only way you can do it is to have some JavaScript or Silverlight on the page that posts back to your server.

Why do you feel you can't use on of these techniques?



来源:https://stackoverflow.com/questions/2337952/from-asp-net-code-behind-aspx-cs-on-the-server-how-can-i-determine-if-silverli

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!