Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Appearance settings

AspNetRequest Url Layout Renderer

Rolf Kristensen edited this page Jun 10, 2023 · 10 revisions

ASP.NET Request URL

Platforms Supported: All

Introduced in NLog.Web 4.3

Configuration Syntax

${aspnet-request-url:IncludeHost=boolean:IncludePort=boolean:IncludeQueryString=boolean:IncludeScheme=boolean}

Parameters

  • Properties - Controls what parts of the Url to output. Default = Scheme, Host, Path

    Introduced with NLog v5.1.1

    • Property Enum Values:
      • Scheme
      • Host
      • Port
      • Path
      • Query
  • IncludeHost - Include the host name? (Assigns Properties |= Host). Default is true.
  • IncludePort - Include the port number? (Assigns Properties |= Port). Default is false.
  • IncludeQueryString - include the querystring. (Assigns Properties |= Query). Default is false.
  • IncludeScheme - Includes the sheme? (Ex. http:// or https://) (Assigns Properties |= Scheme). Default is true.

    Introduced in NLog.Web.AspNetCore v4.4.1 and NLog.Web v4.5.1.

  • IncludePath - Include the path? (Assigns Properties |= Path). Default is true.

    Introduced in NLog.Web.AspNetCore v5.0 and NLog.Web v5.0.

  • UseRawTarget - Extract the path from IHttpRequestFeature.RawTarget? Default is false.

    Introduced in NLog.Web.AspNetCore v4.9.2 (Not supported for NLog.Web)

Examples

${aspnet-request-url:IncludeQueryString=true} - produces http://www.exmaple.com/?t=1
${aspnet-request-url:IncludeQueryString=false} - produces http://www.exmaple.com/
${aspnet-request-url:IncludePort=true} - produces http://www.exmaple.com:80/
${aspnet-request-url:IncludePort=false} - produces http://www.exmaple.com/
${aspnet-request-url:IncludePort=true:IncludeQueryString=true} - produces http://www.exmaple.com:80/?t=1
${aspnet-request-url:IncludeScheme=false} - produces www.exmaple.com 

Clone this wiki locally

Morty Proxy This is a proxified and sanitized view of the page, visit original site.