To allow Foundation to regular get update of Premium Device Data it needs to be given a licence key. This guide is for Foundation projects only. If you're using the Framework see Framework licence guide
here. The key can either be set by creating a .lic file or can be compiled into the Foundation dll file by modifying the source code. The web.config folder will then need to be changed to make sure data is copied correctly.
If you don't have a key for Premium Device Data you can purchase one here. A key will then be emailed to you immediately.
Setting up configuration
The location and name of the Premium Data file is set in web.config or 51Degrees.mobi.config (in the App_Data folder) if you're using the Framework or the WebMatrix Nuget package. By default there is no data location defined as a copy of the Lite Data is embedded into the dll (unlike Foundation Version 1, where data was always a separate file). To set a place for the data, insert the following line into the fiftyOne element of your config (a commented this line should already be in the config)-
<detection binaryFilePath="~/App_Data/51Degrees.mobi-Premium.dat"/>
If this file does not exist the Foundation will fall back to the embedded Lite Data. If you have a premium key the Foundation will attempt to download a Premium Data file into the specified file path. We recommend using App_Data, as the download will fail if the app doesn't have read/writer permissions.
Setting Automatic Updates
To make use of automatic updates your licence key needs to be placed entered into the Foundation with either of the following methods. Alternatively, if you do not wish to use automatic updates you can download Premium Device Data from here manually (you will need your licence key to proceed).
Using a .lic file
To use a .lic file navigate to your web apps bin folder and create a file with any name with the '.lic' file extension (the file should be in the same folder as the Foundation dll). Open this file with a text editor and copy your key into it.
Embedding into the source
We recommend you add the key this way if you're planning to distribute premium data with the Foundation. To add a key you will need to download the source from
Codeplex. You can then find the required constants in 'FiftyOne.Foundation/Properties/Constants.cs'. You should see this line code:
private const string PREMIUM_DATA_KEY = null;
You should change the value from null to your licence key. After recompiling the Foundation will now automatically download device data updates weekly.