Class DeviceDetector
- Namespace
- Dynamicweb.Frontend.Devices
- Assembly
- Dynamicweb.dll
Represents a device detector that is used to detect the device information from a request or context.
- Inheritance
-
Device
Detector
- Inherited Members
Methods
DetectFromRequest(IContext)
Detects device information from the specified context by examining query parameters, session data, or the user agent string.
Parameters
context
IContextAn IContext representing the current HTTP context from which to detect device information.
Returns
- Device
Info A Device
Info object containing the detected device information.
Remarks
The method determines the device information by first checking for a "devicetype" parameter in the query string and storing it in the session if found.
If "devicetype" is not found in the session, it falls back to parsing the user agent string from the request.
If the context, request, or session is invalid, it returns a default Device
IsDeviceDetectionEnabled(IContext)
Checks if device detection is enabled in the given context.
Parameters
context
IContextThe context object.
Returns
- bool
True if device detection is enabled, otherwise false.