Can you please let me know how to get the browser\'s name that the client is using in MVC 6, ASP.NET 5?
I have developed a library to extend ASP.NET Core to support web client browser information detection at Wangkanai.Detection This should let you identity the browser name.
namespace Wangkanai.Detection
{
///
/// Provides the APIs for query client access device.
///
public class DetectionService : IDetectionService
{
public HttpContext Context { get; }
public IUserAgent UserAgent { get; }
public DetectionService(IServiceProvider services)
{
if (services == null) throw new ArgumentNullException(nameof(services));
this.Context = services.GetRequiredService().HttpContext;
this.UserAgent = CreateUserAgent(this.Context);
}
private IUserAgent CreateUserAgent(HttpContext context)
{
if (context == null) throw new ArgumentNullException(nameof(Context));
return new UserAgent(Context.Request.Headers["User-Agent"].FirstOrDefault());
}
}
}