HttpRequest.ServerVariables vs HttpRequest.UserAgent Properties VB.net

What is the difference (if any) and the advantages / disadvantages between the two properties used to define the user agent?

Dim strUserAgt as String userAgent = Request.userAgent 

vs.

 Dim strUserAgt as String = Request.ServerVariables("HTTP_USER_AGENT") 
+4
source share
1 answer

Source: How to detect browser type in server code without a BrowserType object in ASP.NET

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.

It HTTP_USER_AGENT header value no difference, both will retrieve the same thing HTTP_USER_AGENT header value .

Check the Request.ServerVariables Collection and IIS Server Variables if you want to dig it deep. The values ​​of these server variable values ​​are somewhat dependent on the version of IIS.

+3
source

All Articles