Identifying DeviceType using “UserAgent” in ASP.NET

A number of blogs and sites already has written on how we could use “UserAgent” to identify the device type, OS, browser version etc., of the requestor.  But when it came to .net except for the “Request.Browser.IsMobileDevice” there isn’t any inbuilt mechanism to identify the type of device.  Another caveat is that the “Request.Browser.IsMobileDevice” isn’t foolproof and doesn’t support all devices that exist in the market either.

When I had to look for pre-existing options, I stumbled upon some HttpModules (http://51degrees.codeplex.com/) which offers limited properties free of cost, but the rest is offered based on license fee.  There are also free downloads offered by WURFL (http://wurfl.sourceforge.net/) that provides a database bank of all (known) UserAgents for use in projects.

Continue reading

1,607 total views, no views today

Using NInject with ASP.NET MVC Web Api

The standard approach of integrating NInject DI with asp.net MVC doesn’t work for Web Api, due to the updates made to the IDependencyResolver interface.  In order to make it work, need to create a couple of more interfaces that need to be implemented to help identify the dependencies, as provided below:

Continue reading

2,977 total views, 1 views today