overview

Various classes for working with URIs.

Microsoft.AspNetCore.Http.QueryString [ Documentation]

“Provides correct handling for QueryString value when needed to reconstruct a request or redirect URI string.”

Microsoft.AspNetCore.Http.Extensions.QueryBuilder [ Documentation]

“For constructing a query string.”

  • Adding onto an existing query string
  • Constructing a QueryString from a QueryBuilder

Microsoft.AspNetCore.Http.Extensions.UriHelper [ Documentation]

“For constructing encoded URIs for use in headers and other URIs.”

  • Combining URI components into an absolute or relative URI
  • Encoding URIs

Microsoft.AspNetCore.Mvc.Routing.UrlHelper [ Documentation]

“An implementation of IUrlHelper that contains methods to build URLs for ASP.NET MVC within an application.”

  • Requires an ActionContext from the current request

Microsoft.AspNetCore.WebUtilities.QueryHelpers [ Documentation]

“Methods for parsing and manipulating query strings.”

  • Add a query string to a URI
  • Parse a query string into its component key/value pairs

System.Buffers.Text.Base64Url

ℹ️ Important

Availability: .NET 9

Base64 encodes bytes into text composed of a set of 64 characters. This character set includes + and /, both of which have their own meaning in URLs. Base64Url is a scheme that is similar to Base64, but uses a slightly different set of characters. The Base64Url type implements this scheme:

ReadOnlySpan<byte> bytes = ...;
string encoded = Base64Url.EncodeToString(bytes);

System.Uri [ Documentation)]

“Provides an object representation of a uniform resource identifier (URI) and easy access to the parts of the URI.”

  • Checking schema
  • Escaping/un-escaping data

System.UriBuilder [ Documentation]

Constructing and modifying URIs for the Uri class.

  • Properties for each component of a URI

System.Web.HttpUtility [ Documentation]

“Provides methods for encoding and decoding URLs when processing Web requests. This class cannot be inherited.”

  • Encoding/decoding HTML
  • Encoding/decoding URLs
  • Encoding a JavaScript string
  • ParseQueryString into a NameValueCollection