The Universal Device Detection library will parse any User Agent and detect the browser, operating system, device used (desktop, tablet, mobile, tv, cars, console, etc.), brand and model.
Not sure if this is a bug or by design, but the following code just threw a System.ArgumentNullException in our production system while processing a request where HTTP_USER_AGENT was not set:
var botParser = new BotParser();
botParser.SetUserAgent(HttpContext.Current.Request.UserAgent);
return null == botParser.Parse();
A simple workaround is to check if HttpContext.Current.Request.UserAgent is null, but I thought I'd raise this in case it actually is a bug.
Not sure if this is a bug or by design, but the following code just threw a System.ArgumentNullException in our production system while processing a request where HTTP_USER_AGENT was not set:
A simple workaround is to check if
HttpContext.Current.Request.UserAgent
is null, but I thought I'd raise this in case it actually is a bug.