Pergunta

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.

Foi útil?

Solução

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);
Licenciado em: CC-BY-SA com atribuição
Não afiliado a StackOverflow
scroll top