asp-classicbrowscap

How to use browscap.dll on Windows Server running IIS and Classic ASP?


After trying fingerprinting that requires that the visitor use a web browser with JavaScript enabled, I thought that I would try using browscap... browscap.ini and browscap.dll are available on all Windows computer/servers at either C:\Windows\SysWOW64\inetsrv or C:\Windows\System32\inetsrv

But I have yet to see a working example. Perhaps browscap is no longer supported or that modern web browsers are preventing it from getting a result.

As simple test to see if it was indeed being initialised, I tried using the following code on a test page:

<%@ Language=VBScript %>
<% Option Explicit %>

<%
    Dim browserdetect

    Set browserdetect = Server.CreateObject("MSWC.BrowserType")

    if isObject(browserdetect) then
       response.write("The object was created!<br>")
    else
       response.write("The object was not created")
    end if

    Response.Write("Platform = " & browserdetect.Platform & "<br>")
    Response.Write("Browser = " & browserdetect.Browser & "<br>") 
%>

While this code does report that the dll was initialised, there is no result. Of course browsercap.ini should provide much more info and there is a "full" version available for even more info, but what is missing that will enable this simple test to produce a result?


Solution

  • If you are receiving unknown or default as the output, It means your codes are working well but you are using an old limited version of broswecap.ini . By replacing a full version of browsecap.ini in C:\Windows\System32\inetsrv and C:\Windows\SysWOW64\inetsrv , you can access more detailed information. To view all available properties use this code:

    <%
    On Error Resume Next
    
    Set browserdetect = Server.CreateObject("MSWC.BrowserType")
    
    Dim props, prop, val
    props = Array("Browser", "Version", "MajorVer", "MinorVer", "Platform", _
                  "Frames", "Tables", "Cookies", "JavaScript", "VBScript", _
                  "JavaApplets", "ActiveXControls", "CDF", "isMobile", "Device_Type", "Crawler")
    
    For Each prop In props
        val = Eval("browserdetect." & prop)
        If Err.Number <> 0 Then
            Response.Write prop & " = [Not available]<br>"
            Err.Clear
        Else
            Response.Write prop & " = " & val & "<br>"
        End If
    Next
    
    Set browserdetect = Nothing
    %>