{"id":37060914,"url":"https://github.com/w8tcha/uap-csharp","last_synced_at":"2026-01-14T06:54:03.315Z","repository":{"id":183024226,"uuid":"669479171","full_name":"w8tcha/uap-csharp","owner":"w8tcha","description":"C# (ASP.NET CORE) implementation of ua-parser","archived":false,"fork":true,"pushed_at":"2025-12-26T04:35:23.000Z","size":4503,"stargazers_count":5,"open_issues_count":0,"forks_count":3,"subscribers_count":1,"default_branch":"master","last_synced_at":"2025-12-27T15:37:36.034Z","etag":null,"topics":["user-agent","user-agent-parser","useragent","useragentparser"],"latest_commit_sha":null,"homepage":"","language":"C#","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":"ua-parser/uap-csharp","license":"other","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/w8tcha.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":null,"funding":null,"license":"LICENSE","code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null,"governance":null}},"created_at":"2023-07-22T12:13:42.000Z","updated_at":"2025-12-26T04:35:27.000Z","dependencies_parsed_at":"2023-07-22T14:33:32.858Z","dependency_job_id":"b6c0d185-79f9-47d4-81de-786ee7315bca","html_url":"https://github.com/w8tcha/uap-csharp","commit_stats":null,"previous_names":["w8tcha/uap-csharp"],"tags_count":0,"template":false,"template_full_name":null,"purl":"pkg:github/w8tcha/uap-csharp","repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/w8tcha%2Fuap-csharp","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/w8tcha%2Fuap-csharp/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/w8tcha%2Fuap-csharp/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/w8tcha%2Fuap-csharp/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/w8tcha","download_url":"https://codeload.github.com/w8tcha/uap-csharp/tar.gz/refs/heads/master","sbom_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/w8tcha%2Fuap-csharp/sbom","scorecard":null,"host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":286080680,"owners_count":28412467,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2026-01-14T05:26:33.345Z","status":"ssl_error","status_checked_at":"2026-01-14T05:21:57.251Z","response_time":107,"last_error":"SSL_connect returned=1 errno=0 peeraddr=140.82.121.5:443 state=error: unexpected eof while reading","robots_txt_status":"success","robots_txt_updated_at":"2025-07-24T06:49:26.215Z","robots_txt_url":"https://github.com/robots.txt","online":false,"can_crawl_api":true,"host_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub","repositories_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories","repository_names_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repository_names","owners_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners"}},"keywords":["user-agent","user-agent-parser","useragent","useragentparser"],"created_at":"2026-01-14T06:54:02.796Z","updated_at":"2026-01-14T06:54:03.305Z","avatar_url":"https://github.com/w8tcha.png","language":"C#","readme":"UserAgent Parser (based on ua_parser C# Library)\n======================\n\nThis is the ASP.NET Core implementation of [ua-parser](https://github.com/tobie/ua-parser).\n\n[![NuGet](https://img.shields.io/nuget/v/UAParser.Core.svg)](https://nuget.org/packages/UAParser.Core)\n\n[![build dotnet](https://github.com/w8tcha/uap-csharp/actions/workflows/build.yml/badge.svg)](https://github.com/w8tcha/uap-csharp/actions/workflows/build.yml)\n\nThe implementation uses the shared regex patterns and overrides from regexes.yaml (found in [uap-core](https://github.com/ua-parser/uap-core)). The assembly embeds the latest regex patterns (enabled through a node module) which are loaded into the default parser. You can create a parser with more updated regex patterns by using the static methods on `Parser` to pass in specific patterns in yaml format.\n\n## Build and Run Tests\n------\nYou can then build and run the tests by\n\n```` cmd\n\u003e dotnet restore UAParser.Core.sln\n````\n\n```` cmd\n\u003e dotnet test UAParser.Core.sln\n````\n\nUpdate the embedded regexes\n------\nTo pull the latest regexes into the project:\n\n```` cmd\n\u003e npm install \u0026\u0026 grunt\n````\n\n## How to use ?\n\n**Step 1:**\nInstall the [UAParser.Core nuget package](https://www.nuget.org/packages/UAParser.Core/)\n\n\n```` cmd\n\u003e Install-Package UAParser.Core\n````\n\n**Step 2:** Enable the browser detection service inside the `ConfigureServices` method of `Startup.cs`.\n\n```c#\npublic void ConfigureServices(IServiceCollection services)\n{\n    // Add user agent service\n    services.AddUserAgentParser();\n\n    services.AddMvc();\n}\n```\n\n**Step 3:** Inject `IUserAgentParser` to your controller class or view file or middleware and access the `ClientInfo` property.\n\nExample usage in controller code\n\n```c#\npublic class HomeController : Controller\n{\n    private readonly IUserAgentParser userAgentParser;\n    public HomeController(IUserAgentParser parser)\n    {\n        this.userAgentParser = parser;\n    }\n    public IActionResult Index()\n    {\n        var clientInfo = this.userAgentParser.ClientInfo;\n        // Use ClientInfo object as needed.\n\n        return View();\n    }\n}\n```\n\nExample usage in view code\n\n```c#\n@inject UAParser.Interfaces.IUserAgentParser parser\n\n\u003ch2\u003e @parser.ClientInfo.Browser.Family \u003c/h2\u003e\n\u003ch3\u003e @parser.ClientInfo.Browser.Version \u003c/h3\u003e\n\u003ch3\u003e @parser.ClientInfo.OS.ToString() \u003c/h3\u003e\n\u003ch3\u003e @parser.ClientInfo.Device.ToString() \u003c/h3\u003e\n\n```\n\nExample usage in custom middlware\n\nYou can inject the `IUserAgentParser` to the `InvokeAsync` method.\n\n```c#\npublic class MyCustomMiddleware\n{\n    private RequestDelegate next;\n    public MyCustomMiddleware(RequestDelegate next)\n    {\n        this.next = next;\n    }\n    public async Task InvokeAsync(HttpContext httpContext, IUserAgentParser parser)\n    {\n        var clientInfo = parser.ClientInfo;\n\n        if (clientInfo.Browser.Family == \"Edge\")\n        {\n            await httpContext.Response.WriteAsync(\"Have you tried the new chromuim based edge ?\");\n        }\n        else\n        {\n            await this.next.Invoke(httpContext);\n        }\n    }\n}\n```\n\nAuthors:\n-------\n\n  * Søren Enemærke [@sorenenemaerke](https://twitter.com/sorenenemaerke) / [github](https://github.com/enemaerke)\n  * Atif Aziz [@raboof](https://twitter.com/raboof) / [github](https://github.com/atifaziz)\n","funding_links":[],"categories":[],"sub_categories":[],"project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fw8tcha%2Fuap-csharp","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fw8tcha%2Fuap-csharp","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fw8tcha%2Fuap-csharp/lists"}