Skip to content


[Feature request] Add full url layout renderer for ASP.NET MVC #157

MichaelLogutov opened this Issue · 7 comments

5 participants


Currently HTTP_URL for MVC applications does not hold the querystring at all. So the only way to output full url is to write something like this:


Which not only brings unnecessary performance overhead but also always prints "?" no matter if there was a query string specified or not.

Full url is a very common thing for loggin web applications so I think there should be some simple layout rendered like ${url:queryString=true}


For the raw URL, use HTTP_URL or UNENCODED_URL.


Unfortunately this isn't working as described in docs: it does not adds query string variables to the url.


+1. Would be great if it was the full request url, basically like Request.Url.ToString():


Just tried this and it seemed to work:
${aspnet-request:serverVariable=URL}${when:when=length('${aspnet-request:serverVariable=QUERY_STRING}') > 0:inner=?${aspnet-request:serverVariable=QUERY_STRING}}


Like I said - it works, but it's bring unnecessary performance overhead (two templates instead of one) and also prints unnecessary '?' sign at the end of the url without query string.


I'm not sure if/when this was fixed, but HTTP_URL does include the query string in MVC applications. The thing to remember is that you need to include the HTTP_ in front of URL. URL by itself does not include the query string, as the MSDN docs state.


NLog member

@monomial it seems that this has been fixed. If not, then just re-open the issue.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Something went wrong with that request. Please try again.