Search code examples
asp-classiciis-8browscap

MSWC.BrowserType on IIS 8.5 always returns "Unknown" as Platform and "Default" as Browser


We recently moved an old Classic ASP website to a newer Windows Server 2012 running IIS 8.5. After this switch, MSWC.BrowserType can no longer get the browser or platform of a user.

On a test page, I have the following code:

<%@ 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>") 
%>

This returns:

The object was created!
Platform = unknown
Browser = Default

I do have the latest browscap.ini in c:\Windows\System32\inetsrv on the server. Do I need to do anything else for this to work?


Solution

  • As Kul-Tigin pointed out in the comment above, if the application pool running your app is 32-bit (which it was, in my case) browscap.ini will be searched in C:\Windows\SysWOW64\inetsrv.

    I had previously copied the browscap.inito C:\Windows\System32\inetsrv, exactly as I always had done on the old server.