Skip to content

Latest commit

 

History

History
69 lines (43 loc) · 3.04 KB

AspNetRequest-layout-renderer.md

File metadata and controls

69 lines (43 loc) · 3.04 KB

ASP.NET Request variable. This layout renderer is non supported ASP.NET Core!

Supported in .NET and Mono

ASP.NET Core

This layout renderer is broken down to separate layout renders who are more ASP.NET Core compatible / future proof:

Configuration Syntax

${aspnet-request:cookie=String:serverVariable=String:queryString=String
                :item=String:form=String:header=String}

Parameters

Rendering Options

  • cookie - Cookie to be rendered.
  • header - Request header. Introduced in NLog.Web 4.2
  • serverVariable - ServerVariables item to be rendered. See for possible options: msdn. Not supported in ASP.NET Core.
  • queryString - QueryString variable to be rendered.
  • item - Item name. The QueryString, Form, Cookies, or ServerVariables collection variables having the specified name are rendered.
  • form - Form variable to be rendered. Note: The Form property is populated when the HTTP request Content-Type value is either "application/x-www-form-urlencoded" or "multipart/form-data". (see msdn)

Remarks

Use this layout renderer to insert the value of the specified parameter of the ASP.NET Request object. This renderer requires the NLog.Web package.

Examples

Full URL

Full URL without domain, eg default.aspx?id=512

${aspnet-request:serverVariable=HTTP_URL}${aspnet-request:queryString}

Referer

URL doing the request. Including schema (e.g https://) and querystring

${aspnet-request:header=Referer}

Content-Type

Content-Type like application/json; charset=UTF-8

${aspnet-request:header=Content-Type}

Method

Method like PUT, POST, GET etc

${aspnet-request:serverVariable=REQUEST_METHOD}

User agent

user agent, like Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/55.0.2883.87 Safari/537.36

${aspnet-request:serverVariable=HTTP_USER_AGENT}