• About Us
  • Blog
  • Basket
  • Account
  • Sign In
  •  

Differences between V2 and V3

The V3 algorithm is over 100 times faster than V2 and will support millions of device combinations in the future without compromising performance. By default the Premium device data will no longer be loaded into memory improving start-up time and reducing memory consumption.

New features include automatic Image Optimisation in all versions, and support for client side javascript proving more options for those using responsive web design techniques or feeding analytics systems like Google Universal Analytics.

Premium and Enterprise data subscribers get more device properties and features like real time performance monitoring and enhanced detection using client side javascript.

Technically all the popular interfaces have been retained and work in an identical manner to V2. Properties can continue to be retrieved through the Request.Browser object.

var isMobile = Request.Browser.IsMobileDevice;

or

var isTablet = bool.Parse(Request.Browser["IsTablet"]);

In summary upgrading to V3 improves performance and reduces memory consumption both today and in the future as the number of web enabled device combinations continue to increase towards 500,000 and beyond.

Breaking Changes

  • XML is an inefficient form to store device data and required the entire data file to be parsed and loaded into memory. In order to improve memory consumption and performance the XML data format has been retired in V3. Customers using XML format data should use BinaryV3 data.
  • .NET V2 is no longer supported. .NET V3.5 is the minimum supported version and requires Full trust configuration. .NET v4 and above support Medium trust configuration.

File Differences

Both V2 and V3 are delivered using an assembly named FiftyOne.Foundation.dll. The assembly includes embedded Lite device data which will be used if no additional device data is provided.

The following tables explains the names of files used in V2 and V3.

FileV2 File NameV3 File Name
AssemblyFiftyOne.Foundation.dllFiftyOne.Foundation.dll
Configuration51Degrees.mobi.config51Degrees.config
Data FileProvided in the detection element of the config file. Was commented out.Defaults to ~/App_Data/51Degrees.dat. If not present (default) the embedded Lite data will be used.

Need Help?

Upgrading 51Degrees with NuGet

This chapter explains how to upgrade a project configured with NuGet to 51Degrees V3 for both Premium data subscribers and free Lite data users.

Before you begin ensure you have made backup copies of the following files prior to the upgrade:

  1. 51Degrees.mobi.config
  2. Any files under the Mobile folder.

These files are removed when the version 2 NuGet package is removed. You may wish to reapply redirection logic, or other custom configurations to the new V3 files following upgrade.

Package Upgrade

Open the NuGet package manager for the project and select the Updates menu. The 51Degrees package will be shown in the list.

Package upgrade: nuget window

Select the update button to the right of the package to commence the upgrade process.

Following upgrade start the project and verify the /Mobile web page displays properties associated with the device. In Internet Explorer the following page will be displayed.

Verify mobile web page displays properties

Open the newly created 51Degrees.config file and reapply any configuration changes from the V2 51Degrees.mobi.config file and confirm correct operation in your environment.

You can verify the version of data being used by scrolling to the bottom of the /Mobile example page.

Verify version and device data information

These details can also be returned in your own code using the following properties.

<p>Data Published: <% =FiftyOne.Foundation.Mobile.Detection.WebProvider.ActiveProvider.DataSet.Published %></p>
<p>Version Name: <% =FiftyOne.Foundation.Mobile.Detection.WebProvider.ActiveProvider.DataSet.Name %></p>
<p>Version Format: <% =FiftyOne.Foundation.Mobile.Detection.WebProvider.ActiveProvider.DataSet.Format %></p>

If you use Lite data embedded into the assembly then the upgrade is completed.

Premium Data Subscribers

If your licence key file is stored in the Bin folder of the project several minutes after starting the project you may find that the 51Degrees.dat data file has been updated automatically to the latest V3 format data set. Look for the following lines in the log.txt file contained in the App_Data folder.

If your project does not automatically update because of firewall configurations, local security permissions, or download throttling on the 51Degrees data distributor you will need to login to the device data portal and download the data file manually.

https://51degrees.com/Products/Downloads/Premium

Enter your licence key and a screen similar to the following will appear.

Entering license key will bring up this page

Download the Premium Binary V3 data file with the gz extension.

Unzip the file into the App_Data folder and ensure its file name matches the one provided in the 51Degrees.config file. For example; the following line in the 51Degrees.config file would require the file to be named 51Degrees.dat in the App_Data folder.

<detection enabled="true" autoUpdate="true" binaryFilePath="~/App_Data/51Degrees.dat" />

Restart the project and confirm Premium device data is being used by checking the /Mobile web page.

Verify data used is now premium or enterprise

You should also see the following lines in the log file confirming the data source used when the application restarted.

2014-06-03T11:04:46.3451221Z - 7092 - Info - Creating stream provider from binary data file ‘XXX\App_Data\51Degrees.dat.b5769541-00eb-418a-82b2-c13b0e1d8033.tmp'.
2014-06-03T11:04:46.5132693Z - 7092 - Info - Created provider from binary data file 'XXX\App_Data\51Degrees.dat'.

Notice that a new file has been created in the App_Data folder with the extension tmp. Because V3 defaults to storing the device data on disk and no longer loading it into memory a temporary copy of the master data file is needed to ensure device detection is not compromised when the master data file is updated. These temporary files will be automatically removed when the data file changes or the application restarts.

Next Steps

We've configured the default V3 settings to meet most web sites requirements. You may wish to review these to ensure they're configured appropriately for your web site. Documentation is included inline with the 51Degrees.config file and is also detailed on Web Applications Config page.