useragent 串格式_.NET Framework和浏览器的UserAgent字符串

useragent 串格式

useragent 串格式

One of the things I'd said I'd do, Dear Reader, when I went to work for the Big Blue Monster, was to get your feedback into The Company whenever possible. Here's another opportunity for us to effect change, however small.

亲爱的读者,我曾说过要做的一件事,就是在我为“蓝色巨人”工作时,尽可能将您的反馈意见反馈给公司。 这是我们实现变化的又一个机会,尽管规模很小。

A while back I made a little site called http://www.smallestdotnet.com that would look at your Browser's UserAgent

不久前,我做了一个名为http://www.smallestdotnet.com的小网站,该网站将查看您浏览器的UserAgent

and let you know the size that the latest .NET Framework would be for you (ballpark size). In the process I've gotten to see a LOT of interesting Browser UserAgents in the IIS logs.

并告知您最新的.NET Framework适合您的大小(大致大小)。 在此过程中,我已经在IIS日志中看到了很多有趣的Browser UserAgent。

If you visit the site and scroll down, you'll see YOUR Browser UserAgent at the bottom. Here's mine:

如果您访问该网站并向下滚动,则会在底部看到您的浏览器UserAgent。 这是我的:

Mozilla/4.0 (compatible; MSIE 8.0; Windows NT 6.0; WOW64; Trident/4.0; SLCC1; .NET CLR 2.0.50727; .NET CLR 3.5.21022; Media Center PC 5.0; Zune 2.5; MS-RTC LM 8; .NET CLR 3.0.30618)

Mozilla / 4.0(兼容; MSIE 8.0; Windows NT 6.0; WOW64; Trident / 4.0; SLCC1; .NET CLR 2.0.50727; .NET CLR 3.5.21022; Media Center PC 5.0; Zune 2.5; MS-RTC LM 8;。 NET CLR 3.0.30618)

Notice that I've got IE8 on 64-bit Windows. However, there's other stuff in there, like I have the Zune software, I have Media Center enabled, and I've got three versions of the .NET Framework. In this example, 2.0, 3.0, and 3.5.

请注意,我在64位Windows上具有IE8。 但是,其中还有其他内容,例如我拥有Zune软件,启用了Media Center,并且我具有三个版本的.NET Framework。 在此示例中,为2.0、3.0和3.5。

Here's a UserAgent that showed up today on http://www.smallestdotnet.com:

这是一个今天出现在http://www.smallestdotnet.com上的UserAgent:

Mozilla/4.0 (compatible; MSIE 7.0; Windows NT 5.1; Mozilla/4.0 (compatible; MSIE 6.0; Windows NT 5.1; SV1) ; .NET CLR 1.0.3705; InfoPath.1; .NET CLR 2.0.50727; .NET CLR 3.0.04506.30; .NET CLR 1.1.4322; .NET CLR 3.0.04506.590; .NET CLR 3.5.20706; .NET CLR 3.0.04506.648; .NET CLR 3.5.21022; Zune 2.5; WWTClient2; MS-RTC LM 8; .NET CLR 3.0.4506.2152; .NET CLR 3.5.30729)

Mozilla / 4.0(兼容; MSIE 7.0; Windows NT 5.1; Mozilla / 4.0(兼容; MSIE 6.0; Windows NT 5.1; SV1); .NET CLR 1.0.3705; InfoPath.1; .NET CLR 2.0.50727; .NET CLR 3.0.04506.30; .NET CLR 1.1.4322; .NET CLR 3.0.04506.590; .NET CLR 3.5.20706; .NET CLR 3.0.04506.648; .NET CLR 3.5.21022; Zune 2.5; WWTClient2; MS-RTC LM 8; .NET CLR 3.0.4506.2152; .NET CLR 3.5.30729)

Now, this guy is clearly a developer who has installed beta versions of things, but he's also got InfoPath and a bunch of other stuff. Still, that's a pretty crazy UserAgent and it's being transmitted all the time.

现在,这个人显然是已经安装了beta版本的东西的开发人员,但是他还拥有InfoPath和许多其他东西。 尽管如此,这仍然是一个非常疯狂的UserAgent,并且一直在传输。

Registry Editor

UserAgents are added for IE in the Registry, as seen in the screenshot above.

如上面的屏幕快照所示,在注册表中为IE添加了UserAgent。

你为什么要在乎? (Why Should You Care?)

In the case of a system with IE and a lot of .NET Framework versions, ASP.NET currently truncates the UserAgent at 256 characters so my own case, the site was only getting part of the story. They might change that truncation number, but ultimately, I think we all want tidy UserAgents, right?

对于具有IE和许多.NET Framework版本的系统,ASP.NET当前将UserAgent截断为256个字符,因此以我个人的情况来看,该网站只是其中的一部分。 他们可能会更改该截断号,但是最终,我认为我们都希望整洁的UserAgent,对吗?

UserAgent length matters. Early versions of FireFox had a UserAgent Limit of 127 characters and used to return null before the bug was fixed last month and now it truncates. The FireFox plugin added when you installed .NET by default only shows the most recent .NET Framework. Do you want that functionality in .NET?

UserAgent的长度很重要。 早期版本的FireFox的UserAgent限制为127个字符,并且在上个月修复该错误之前曾经返回null ,而现在该错误被截断默认情况下安装.NET时添加的FireFox插件仅显示最新的.NET Framework。 您是否想要.NET中的功能?

Truncated UserAgents can also mean you might get "Unknown" Back from Request.Browser.Browser. In my case, I was getting an exception from Request.Browser.ClrVersion because the truncated CLR Version was something like ".NET CLR 3.".

截断的UserAgents也可能意味着您可能会从Request.Browser.Browser中获得“未知”的信息。 就我而言,我从Request.Browser.ClrVersion中获取了异常,因为截断的CLR版本类似于“ .NET CLR 3”。

There's some people looking at this internally, and there's three groups involved. There's Internet Explorer, involved peripherally, there's the CLR Team and the installer that adds the values, and there's the ASP.NET team who cares because of the server-side sniffing.

内部有人在看这个,涉及三个小组。 这里有Internet Explorer,周围有CLR团队和安装程序来添加值,还有ASP.NET团队在乎服务器端的嗅探。

投票/问题 (Poll/Questions)

The questions I have for you are these:

我对您的问题是:

  • Do you use these .NET Framework-specific values? What for? How do they improve your site or make your user experience different?

    您是否使用这些特定于.NET Framework的值? 做什么的? 他们如何改善您的网站或使您的用户体验有所不同?

  • If the .NET Framework-specific values were removed completely what would that mean to you or your business?

    如果完全删除了.NET Framework特定的值,这对您或您的企业意味着什么?

  • What if the values were conflated to show just the most recent .NET Framework?

    如果将这些值混合以仅显示最新的.NET Framework怎么办?

    • Could you get the information you needed using just the value of the latest version?

      您能仅使用最新版本的值来获得所需的信息吗?
  • What if the values were conflated to show just the major side-by-side CLR releases?

    如果将这些值混合以仅显示主要的并行CLR版本怎么办?

    • For example, 1.x, 3.5SP1 and 4.0. In that example, 3.5SP1 implies 2.x and 3.0. If you just had 2.0, you'd see 1.x, 2.0, and that'd be it.

      例如1.x,3.5SP1和4.0。 在该示例中,3.5SP1表示2.x和3.0。 如果您只有2.0,就会看到1.x,2.0,仅此而已。
    • Could you get the information you needed using just the value of the those major CLR/Framework versions?

      您能仅使用那些主要CLR / Framework版本的值来获得所需的信息吗?

Please take a moment and do this micropoll. It's ONE question with ONE vote button. Literally two seconds of your time. You can also add the poll to your blog. Also, leave comments and I'll make sure the right people seem them.

花一点时间进行此微型投票。 有一个投票按钮的一个问题。 从字面上看,您的时间是两秒钟。 您也可以将民意调查添加到博客中。 另外,留下评论,我会确保合适的人看起来正确。

翻译自: https://www.hanselman.com/blog/the-net-framework-and-the-browsers-useragent-string

useragent 串格式

  • 0
    点赞
  • 0
    收藏
    觉得还不错? 一键收藏
  • 0
    评论

“相关推荐”对你有帮助么?

  • 非常没帮助
  • 没帮助
  • 一般
  • 有帮助
  • 非常有帮助
提交
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值