I am using the WURFLManager on my website (ASP.net C# 4.0) to detect the capability of mobile devices. I have followed the walkthrough here.

In my Globl.asax Application_Start() method I have this:

WURFLManagerBuilder.Build(new ApplicationConfigurer());

Then on one of my ASPX pages I attempt to use WURFLManager like this:

if (Request != null && Request.UserAgent != null)
{                        
    IDevice device = WURFLManager.Instance.GetDeviceForRequest(Request.UserAgent);
}

The WURFLManager object is always null and so throws an Object Reference error.

有帮助吗?

解决方案

Well I found the answer. It seems as though the API must have changed at some point. I'm not able to find out if the DLL we are using has been updated.

But anyway here is the solution:

var mgr = WURFLManagerBuilder.Build(new ApplicationConfigurer());
var device = WURFLManagerBuilder.Instance.GetDeviceForRequest(Request.UserAgent);
许可以下: CC-BY-SA归因
不隶属于 StackOverflow
scroll top