[英]in a controller in asp.net-mvc how can i get information about the users browser?
I am logging errors on my asp.net-mvc site and I wanted to see if there is anyway to detect the users browser info (name, version, etc) as it seems like people are getting issue but its because they are using very old browser.我在我的 asp.net-mvc 站点上记录错误,我想看看是否有任何方法可以检测用户浏览器信息(名称、版本等),因为似乎人们遇到了问题,但这是因为他们使用的是非常旧的浏览器。 This info would help me avoid debugging time if I know they are using a "Not supported" browser.如果我知道他们使用的是“不支持”浏览器,这些信息将帮助我避免调试时间。
You can get the supplied User Agent which gives browser information:您可以获得提供的用户代理,它提供浏览器信息:
Request.UserAgent
There is a site which lists browser user agent strings: http://www.useragentstring.com有一个网站列出了浏览器用户代理字符串: http://www.useragentstring.com
Other values you may be interested in.您可能感兴趣的其他值。
Request.Browser.Platform
Request.Browser.Version
Request.Browser.EcmaScriptVersion
You may try the Request.Browser property.您可以尝试Request.Browser属性。 It will contain pretty much everything you might need about the client browser (assuming it is sending the UserAgent header properly of course).它将包含您可能需要的有关客户端浏览器的几乎所有内容(当然,假设它正在正确发送 UserAgent header)。
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.