0

I have a .net application that has both mobile and traditional web pages. For device detection i am using wurfl, problem is not matter what chrome is detected as mobile. i have tried using all available version of wurlf, as well as using the web browser patch. My logs show the following no matter what pc is logged in. Any help or experience with this would be appreciated

Client Browser Information:
UserAgent: Mozilla/5.0 (Windows NT 6.1; WOW64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/35.0.1916.153 Safari/537.36
IsMobileDevice: True
MobileDeviceManufacturer: Asus
MobileDeviceModel: Transformer Pad TF300T
Browser: Chrome
MajorVersion: 35
MinorVersion: 0
Id: chrome
InputType: keyboard
Platform: Android
EcmaScriptVersion: 3.0
user1902540
  • 111
  • 2
  • 12

1 Answers1

1

The request.browser.isMobileDevice lives outside of wurfl, and won't be affected by whether you include wurfl or not. unless your are explicitely overriding that value with the wurfl value, which it does not sound like you are from your description.

The documentation on using the wurfl api is very good, and can be found here

http://wurfl.sourceforge.net/dotnet_index.php

it shows how to set up the WurflManager and how to check "capabilities" like is_mobile based on the device object that which is based off of the user agent you pass in. After setting up, this call in particular will return if it is mobile or not

device.GetVirtualCapability("is_mobile")

Your User Agent looks correct for the default Chrome desktop browser, so that should not be the issue.

to set up an MVC Site to be able to route to separate Mobile Views using the .Mobile extension. you would set something like this in the Global.asax

        // Remove default Mobile display mode if previously registered
        var dm = DisplayModeProvider.Instance.Modes
            .FirstOrDefault(x => x.DisplayModeId == DisplayModeProvider.MobileDisplayModeId);
        if (dm != null)
        {
            DisplayModeProvider.Instance.Modes.Remove(dm);
        }

        var configurer = new ApplicationConfigurer();
        var manager = WURFLManagerBuilder.Build(configurer);

        DisplayModeProvider.Instance.Modes.Insert(0, new DefaultDisplayMode("Mobile")
        {
            ContextCondition = Context => manager.GetDeviceForRequest(Context.Request.UserAgent).GetVirtualCapability("is_mobile") == "true"
        });

If you're using some other tech stack, or are not routing views this way in MVC, this article covers most of those use cases in detail.

http://www.asp.net/whitepapers/add-mobile-pages-to-your-aspnet-web-forms-mvc-application

you will still want to create the WurflManager, and check the capabilities that same as above, but you will do so wherever you would typically do your check for IsMobileDevice.

Mabdullah
  • 1,013
  • 6
  • 26