Browser
Members
Namespace: ASPSecurityKit
Assembly: ASPSecurityKit.dll
Summary
Provides an implementation for IBrowser to determine browser information from user agent strings using the UAParser library.
Methods
GetIdentifier(userAgent)
Summary
Attempts to identify the browser name and Operating System from the given user agent and returns the same.
Returns
If successful, an identifier that includes names of the browser and operating system; otherwise, an empty or ‘unknown’ string.
Parameters
Name | Type | Description |
---|---|---|
userAgent | System.String | The user agent. |
Exceptions
Type | Description |
---|---|
System.ArgumentNullException | When userAgent is null or whitespace. |
IsBrowser(userAgent)
Summary
Determines whether the specified user agent belongs to a known browser. If somehow userAgent string couldn’t be parsed, even then returns false.
Returns
true
if the specified user agent belongs to a known browser; otherwise, false
.
Parameters
Name | Type | Description |
---|---|---|
userAgent | System.String | The user agent. |
Exceptions
Type | Description |
---|---|
System.ArgumentNullException | When userAgent is null or whitespace. |