x First time here? Check out the FAQ

Learn from 350 other Umbracians at the annual Umbraco Conference - CodeGarden '13.
More than twenty high quality sessions, open spaces, hackathons and social events you'll remember. Not to be missed!
Less than 25 tickets left - get yours now!

RequestServerVariables

    This function can return the value of any of the Server Variables in the current HTTP Request. eg. to get the user agent string of the browser being used to request a page you would use:

    <xsl:value-of select="umbraco.library:RequestServerVariables('HTTP_USER_AGENT')"/> 

    Example - How to create a fully qualified self referencing link

    To create a self referencing URL using the SERVER_NAME server variable:

    <a>
    <xsl:attribute name="href">
    <xsl:text>http://</xsl:text>
    <xsl:value-of select="umbraco.library:RequestServerVariables('SERVER_NAME')"/>
    <xsl:value-of select="umbraco.library:NiceUrl($currentPage/@id)"/>
    </xsl:attribute>
    Link Text
    </a>

    This can also be written as:

    <a href="http://{umbraco.library:RequestServerVariables('SERVER_NAME')}{umbraco.library:NiceUrl($currentPage/@id)}">
    Link Text
    </a>

    Using this page as an example, both of the above examples would return:

    <a href="http://our.umbraco.org/wiki/reference/umbracolibrary/requestservervariables">
    Link Text
    </a>