Introduction

edit

Meziantou.Framework.Uri gathers helpers to work with URLs in .NET:

  • URL patterns: an implementation of the WHATWG URL Pattern standard, the pattern syntax browsers use (https://*.example.com/books/:id). Test whether a URL matches a pattern and extract the values of its groups.
  • Query strings: parse a query string into names and values, and add, replace or remove parameters of a URL.
  • Public Suffix List: find the public suffix (co.uk) and the registrable domain (example.co.uk) of a host name, from a snapshot of the Public Suffix List compiled into the assembly.

What you can do with it

  • Route or filter URLs with patterns that read like URLs, instead of regular expressions. See Matching URLs and Pattern syntax.
  • Find which pattern of a list matches a URL, such as the route of a request. See Pattern collections.
  • Build URLs by adding, replacing and removing query string parameters, with the values encoded for you. See Query strings.
  • Decide whether two hosts belong to the same site, or which part of a host name a registrant controls, for cookies, security checks or grouping URLs by site. See Public Suffix List.

Namespace

Every type is in the Meziantou.Framework namespace: UrlPattern, UrlPatternInit, UrlPatternOptions, UrlPatternResult, UrlPatternCollection, QueryStringUtilities, QueryStringParameterCollection, PublicSuffixList and DomainInfo.

Next steps