检测.NET版本没有的UserAgent字符串 [英] Detecting .NET version without UserAgent string

查看:164
本文介绍了检测.NET版本没有的UserAgent字符串的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

大多数现代浏览器(Chrome浏览器10,火狐4,IE9)都缩短他们的UserAgent标识。其结果是,所支持的.NET版本不再发送给服务器。

Most modern browsers (Chrome 10, Firefox 4, IE9) are all shortening their UserAgent identifiers. As a result, the supported .NET versions are no longer sent to the server.

为了让我们的客户能够使用我们的ClickOnce应用程序,我们需要知道哪些框架是由客户端支持。

In order to allow our customers to use our ClickOnce application, we need to know which frameworks are supported by the client.

Javascript的检测Chrome和Firefox的ClickOnce助手是一个开始(这些现在都没有在Firefox 4),但我们不再有检测客户端是否有.NET 2.0,3.5或4.0安装的方式。

Javascript detection of the Chrome and Firefox ClickOnce helpers are a start (these are now failing in Firefox 4), but we no longer have a way of detecting if the client has .NET 2.0, 3.5 or 4.0 installed.

从用户代理字符串检测Windows平台限制和推理的最有可能的架构(XP = 1.1,Vista的= 2.0,Win7的= 3.5),我们如何能够检测.NET框架的支持?

Barring from detecting the Windows platform from the UserAgent string and inferring the most likely framework (XP = 1.1, Vista=2.0, Win7=3.5), how could we detect .NET framework support?

(我们要prevent的。应用文件下载为我们的大多数客户似乎并没有注意到下载背后弹出式窗口)

(We want to prevent the .application file downloading as most of our clients don't seem to notice the downloading "pop-unders")

推荐答案

这个问题是<一个href="https://connectppe.microsoft.com/VisualStudio/feedback/details/667720/microsoft-net-framework-assistant-1-2-2-for-firefox-does-not-report-net-version-in-user-agent"相对=nofollow>修复微软。 .NET版本现已返回一个HTTP请求头,X-ClickOnceSupport。

This problem was fixed by Microsoft. The .NET version is now returned as an HTTP request header, "X-ClickOnceSupport".

在PHP中,你将通过GETENV得到这个()

In PHP, you would get this via getenv()

print getenv('HTTP_X_CLICKONCESUPPORT');

在Perl中

print $ENV{HTTP_X_CLICKONCESUPPORT};

在JavaScript的是不可能的,根据<一href="http://stackoverflow.com/questions/220149/how-do-i-access-the-http-request-header-fields-via-javascript">this回答。

In JavaScript it is not possible, according to this answer.

(这一切都通过检查Firefox的.NET助理,害得我搜索X-ClickOnceSupport头的code开始。喜欢能够查看源$ C ​​$ C,解决了没有谜!)

(This all started by examining the code of the Firefox .NET Assistant, which led me to search for the "X-ClickOnceSupport" header. Nothing like being able to view the source code to solve a mystery!)

这篇关于检测.NET版本没有的UserAgent字符串的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆