Reputation: 39
I am using the code below:
Request.Headers["User-Agent"].ToString()
But it's giving me all browser details despite I only want the browser name.
Can anyone please help me with this problem?
Upvotes: 1
Views: 2770
Reputation: 1545
User-Agent strings can come in various form, so it's better to use an API such as User Agent Parsing API to get better results.
You've not explained us why you want to detect the browser. But take some time to read MDN advices about/against browser detection:
Using the user agent to detect the browser looks simple, but doing it well is, in fact, a very hard problem. This document will guide you in doing this as correctly as possible.
Upvotes: 1