- Getting Started
- Upgrade V2 to V3
- Operational Summary
- Automatic Data Updates
- Web Applications
- trie matching
- Image Optimiser
- Passing Properties To Client Side
- Client Side Overrides
- User Performance Monitoring
- Offline Applications
- Accessing Metadata
- SQL Server
- IIS Modification
- Log Troubleshooting
- Native Code
- Examples And Questions
What is TRIE matching?
Trie is the fastest device detection solution that 51Degrees provides at the expense of the data file size and lack of auto updates. The size of the uncompressed data file is close to 1Gb for Premium and Enterprise files. Learn how Trie matching works .
Trie in the .NET environment
Currently Trie for .NET relies on reading the data directly from the data file to perform device detection.
To perform device detection using the Trie provider:
- Create a TrieProvider object by invoking the create method of the TrieFactory.
- Call the GetDeviceIndex function and supply it with the User Agent you want to match. The function will return device index as an integer.
- Call the GetPropertyValue function and supply it with the device index from step 2 and the name of the property you want to get, i.e. "IsMobile".
Websites and Web Projects
By default the DLL is supplied with the Pattern provider that is controlled through the 51Degrees.config file, If you wish to use Trie detection you will need to set the enabled option to false in the detection section of the 51Degrees.config to avoid performing detection with the built in Pattern method and comment out the redirect section.
If you do not have the Global.asax file in your project you will need to create one. You will then need to create a public static TrieProvider object and instantiate it upon the ApplicationStart. Your Global.asax should look something like this:
The idea is that the detection will take place upon the Page_Load. For example:
Once the device has been detected you can then apply some logic. In this example the text of the asp label changes to either "True" or "False" depending on the outcome, but you can do other things like redirect or change the content being added.
MVC projects follow similar logic. You will need a Global.asax to instantiate a TrieProvider at application start. The detection and logic are then executed in the Controller.
Trie data file updates
Currently the .NET API does not support automatic updates for the Trie data files due to the size of the data files. The 51Degrees update server is configured to supply Trie data files if requested so you can implement the update logic yourself. For more information on data updates please see: Automatic Updates section of the documentation.