문제

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