HttpRequest.ServerVariables与HttpRequest.UserAgent属性VB.net [英] HttpRequest.ServerVariables vs HttpRequest.UserAgent Properties VB.net
问题描述
用于确定用户代理的这两个属性之间的区别(如果有)和优点/缺点是什么?
What would be the difference (if any) and advantages/disadvantages between these two properties used to determine the user agent?
Dim strUserAgt as String
userAgent = Request.userAgent
vs.
Dim strUserAgt as String = Request.ServerVariables("HTTP_USER_AGENT")
推荐答案
来源:如何确定浏览器类型ASP.NET中没有BrowserType对象的服务器端代码
在ASP.NET中,您可以访问Request.ServerVariables集合或 使用新的Request.UserAgent属性检索HTTP_USER_AGENT 标头值.
In ASP.NET, you can access the Request.ServerVariables collection or use the new Request.UserAgent property to retrieve the HTTP_USER_AGENT header value.
没有什么区别,两者都会检索相同的内容.
There are no difference, both will retrieve same thing HTTP_USER_AGENT header value
.
检查 Request.ServerVariables集合和 IIS服务器变量想深入挖掘.这些服务器变量收集值在某种程度上也取决于IIS版本.
Check Request.ServerVariables Collection and IIS Server Variables if you want to dig it in deep. These server variables collection values somewhat depend ond the IIS version also.
这篇关于HttpRequest.ServerVariables与HttpRequest.UserAgent属性VB.net的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!