Movatterモバイル変換


[0]ホーム

URL:


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

Sign up
Appearance settings
/NLogPublic

AspNetRequest layout renderer

Rolf Kristensen edited this pageMay 31, 2023 ·37 revisions

ASP.NET Request variable.

Platforms Supported:All

ASP.NET Core

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

And there are many moreNLog LayoutRenderers to choose from

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 to be rendered. Introduced in NLog.Web 4.2
  • serverVariable - ServerVariables item to be rendered. See for possible options:msdn.

    Not supported on ASP.NET Core until NLog.Web.AspNetCore v5.1

  • queryString - QueryString variable to be rendered.
  • item - HttpConterxt Item name to be 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". (seemsdn)

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, egdefault.aspx?id=512

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

Referer

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

${aspnet-request:header=Referer}

Content-Type

Content-Type likeapplication/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}

-Troubleshooting Guide - See available NLog Targets and Layouts:https://nlog-project.org/config

Configuration

Programmatic Configuration

Advanced

Extending NLog

Clone this wiki locally


[8]ページ先頭

©2009-2025 Movatter.jp