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

Closed
MichaelLogutov opened this Issue Nov 2, 2012 · 9 comments

Comments

Projects
None yet
6 participants
@MichaelLogutov
Contributor

MichaelLogutov commented Nov 2, 2012

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:

${aspnet-request:serverVariable=URL}?${aspnet-request:serverVariable=QUERY_STRING}

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}

@DannyVarod

This comment has been minimized.

Show comment
Hide comment
@DannyVarod

DannyVarod Jan 1, 2013

Contributor

From http://msdn.microsoft.com/en-us/library/ms524602.aspx
For the raw URL, use HTTP_URL or UNENCODED_URL.

Contributor

DannyVarod commented Jan 1, 2013

From http://msdn.microsoft.com/en-us/library/ms524602.aspx
For the raw URL, use HTTP_URL or UNENCODED_URL.

@MichaelLogutov

This comment has been minimized.

Show comment
Hide comment
@MichaelLogutov

MichaelLogutov Jan 1, 2013

Contributor

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

Contributor

MichaelLogutov commented Jan 1, 2013

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

@bkryl

This comment has been minimized.

Show comment
Hide comment
@bkryl

bkryl Feb 27, 2013

Contributor

+1. Would be great if it was the full request url, basically like Request.Url.ToString(): http://www.example.com:8080/page.html?q=sample

Contributor

bkryl commented Feb 27, 2013

+1. Would be great if it was the full request url, basically like Request.Url.ToString(): http://www.example.com:8080/page.html?q=sample

@ghost

This comment has been minimized.

Show comment
Hide comment
@ghost

ghost Oct 9, 2013

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}}

ghost commented Oct 9, 2013

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}}

@MichaelLogutov

This comment has been minimized.

Show comment
Hide comment
@MichaelLogutov

MichaelLogutov Oct 10, 2013

Contributor

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.

Contributor

MichaelLogutov commented Oct 10, 2013

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.

@monomial

This comment has been minimized.

Show comment
Hide comment
@monomial

monomial Jul 1, 2014

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.

${aspnet-request:serverVariable=HTTP_URL}

monomial commented Jul 1, 2014

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.

${aspnet-request:serverVariable=HTTP_URL}

@304NotModified

This comment has been minimized.

Show comment
Hide comment
@304NotModified

304NotModified Jan 16, 2015

Member

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

Member

304NotModified commented Jan 16, 2015

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

@doabil

This comment has been minimized.

Show comment
Hide comment
@doabil

doabil Aug 16, 2017

Hi, I use Nlog my ASP MVC project. But. I dont get URL ?
The codes in the responses are not working
I'm waiting for help

doabil commented Aug 16, 2017

Hi, I use Nlog my ASP MVC project. But. I dont get URL ?
The codes in the responses are not working
I'm waiting for help

@304NotModified

This comment has been minimized.

Show comment
Hide comment
@304NotModified

304NotModified Aug 16, 2017

Member

Please create a new github issue and fill in the template.

Member

304NotModified commented Aug 16, 2017

Please create a new github issue and fill in the template.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment