Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with HTTPS or Subversion.

Download ZIP

Loading…

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

Closed
MichaelLogutov opened this Issue · 7 comments

5 participants

@MichaelLogutov

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

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

@MichaelLogutov

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

@bkryl

+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

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

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

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
Collaborator

@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.