Check out the latest documentation.

Detection - Version 3

The detection element controls where device data is found and other features that help in mobile optimisation. The detection element is not mandatory; if the section is missing or the device data is missing or corrupt, the Foundation reverts to an embedded Lite device file included in the DLL. The latest version can be downloaded from Codeplex . See our Property Dictionary for more information on free Lite and paid-for enhanced options.

The detection element supports the following attributes.

Attributes

Mandatory

Description

enabled

No

Controls whether device detection to override default Request.Browser properties is enabled.

Note: Calls to the ActiveProvider or EmbeddedProvider properties of the WebProvider class will still be allowed.

binaryFilePath

No

The virtual or absolute path to the uncompressed binary V3 format device data.

If this file does not exist or can not be read the Foundation will fall back to the embedded Lite Data. If you have a licence 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 application pool's identity doesn't have read/write permissions. See the Data Update page for more information.

autoUpdate

No

When set to true enables automatic updating of device data when licence keys are provided. Defaults to true. See the licence keys and automatic update page for more information.

shareUsage

No

Set to true to share usage information with 51Degrees.com. Read the Usage Data FAQ to learn more. Defaults to True if not specified.

memoryMode

No

True if the data set should be loaded into memory. Detection performance will be significantly faster at the expense of a longer startup time and increased memory usage. Defaults to False.

bandwidthMonitoringEnabled

No

When set to true enables bandwidth monitoring. Also requires the data set specified in the binaryFilePath attribute to support bandwidth monitoring. Defaults to True.

featureDetectionEnabled

No

When set to true enables feature detection. Also requires the data set specified in the binaryFilePath attribute to support feature detection. Defaults to True.

Detection - Version 2

The detection element replaces the wurfl element used in previous versions of the Foundation (v0.x, v1.x). Due to licensing changes from ScientiaMobile, the 51Degrees Foundation no longer supports WURFL data and instead uses 51Degrees Device Data. To convert an existing v1.x installation, Foundation v2.x or greater needs to be downloaded and the wurfl element removed. The latest version can be downloaded from Codeplex . See our Property Dictionary for more information on free Lite and paid-for Premium options.

The detection section controls where 51Degrees.com finds device data and the capabilities to load. The detection element is not mandatory; if the section is missing or the device data is missing or corrupt, the Foundation reverts to an embedded Lite device file included in the DLL.

binaryFiles and xmlFiles

The binaryFiles and xmlFiles elements are used to the tell the Foundation where to find device data files. Foundation includes embedded Lite device data within the assembly and the section is not required to use Lite data. It should be used with Premium data to control where the data file is located. Binary and XML format data files contain the same properties and devices, the only difference is that they represent the data in two different formats. Binary data is more efficient, whilst XML is human readable. The following example configuration shows the most common setting placing the Premium data file in the App_Data folder.

										
										<detection
										
										
										binaryFilePath=
										
									"~/App_Data/51Degrees.com-Premium.dat" 
										
										/>
										
									


or

										
										<detection
										
										
										binaryFilePath=
										
									"C:\inetpub\wwwroot\App_Data\51Degrees.com-Premium.dat" 
										
										/>
										
									


The detection element supports the following attributes.

Attributes

Mandatory

Description

binaryFilePath

No

The virtual or absolute path to store binary format device data.

shareUsage

No

(Version 2.1.5 onwards) Set to true to share usage information with 51Degrees.com. Read the Usage Data FAQ to learn more. Defaults to True if not specified.

A child element called xmlFiles can be used to provide the location of 1 or more XML format data files. It can be used with binaryFilePath to provide additional patch files.

										
										<detection>
										
										
										<xmlFiles>
										
										
										<add
										
										
										name=
										
									"Lite" 
   
										
										filePath=
										
									"~/App_Data/51Degrees.mobi-Lite.xml.gz" 
   
										
										enabled=
										
									"true"
  
										
										/>
										
										
										<add
										
										
										name=
										
									"examplePatchFile" 
   
										
										filePath=
										
									"~/App_Data/Example_Patch.xml" 
   
										
										enabled=
										
									"false"
  
										
										/>
										
										
										</xmlFiles>
										
										
										</detection>
										
									


Each xml file needs to be added with an 'Add' element. Binary and xml files can be used in any combination.

Attributes

Mandatory

Description

name

Yes

Descriptive names of the file for your reference.

filePath

Yes

A virtual or absolute path to the data patch file.

enabled

Yes

True if the patch file should be included when the API loads device data. False if it should be ignored.

If this file does not exist the Foundation will fall back to the embedded Lite Data. If you have a licence 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 application pool's identity doesn't have read/write permissions. See the Data Update page for more information.