Copied to clipboard

Flag this post as spam?

This post will be reported to the moderators as potential spam to be looked at


  • curlybub 133 posts 107 karma points
    Mar 05, 2010 @ 02:38
    curlybub
    0

    umbraco.library:IsLoggedOn() Error

    Hi,

    Im trying to create an xslt macro with the help of dandrayne to check whether the user is logged in or not. If they are logged in they can post comments to a blog post, but if not it will require them to login. How ever I cant find what I'm doing wrong.

    Here is the error:

    Error occured

    System.NullReferenceException: Object reference not set to an instance of an object.
    at umbraco.BusinessLogic.StateHelper.GetCookieValue(HttpContext context, String key)
    at umbraco.BusinessLogic.StateHelper.HasCookieValue(String key)
    at umbraco.cms.businesslogic.member.Member.CurrentMemberId()
    at umbraco.cms.businesslogic.member.Member.IsLoggedOn()
    at umbraco.library.IsLoggedOn()

    Here is the xslt code:

    <?xml version="1.0" encoding="UTF-8"?>
    <!DOCTYPE xsl:stylesheet [ <!ENTITY nbsp "&#x00A0;"> ]>
    <xsl:stylesheet
     version="1.0"
     xmlns:xsl="http://www.w3.org/1999/XSL/Transform"
     xmlns:msxml="urn:schemas-microsoft-com:xslt"
     xmlns:umbraco.library="urn:umbraco.library" xmlns:Exslt.ExsltCommon="urn:Exslt.ExsltCommon" xmlns:Exslt.ExsltDatesAndTimes="urn:Exslt.ExsltDatesAndTimes" xmlns:Exslt.ExsltMath="urn:Exslt.ExsltMath" xmlns:Exslt.ExsltRegularExpressions="urn:Exslt.ExsltRegularExpressions" xmlns:Exslt.ExsltStrings="urn:Exslt.ExsltStrings" xmlns:Exslt.ExsltSets="urn:Exslt.ExsltSets" xmlns:MailEngine="urn:MailEngine" xmlns:pdcalendar="urn:pdcalendar" xmlns:Designit.VideoEmbed="urn:Designit.VideoEmbed" xmlns:tagsLib="urn:tagsLib" xmlns:BlogLibrary="urn:BlogLibrary"
     exclude-result-prefixes="msxml umbraco.library Exslt.ExsltCommon Exslt.ExsltDatesAndTimes Exslt.ExsltMath Exslt.ExsltRegularExpressions Exslt.ExsltStrings Exslt.ExsltSets MailEngine pdcalendar Designit.VideoEmbed tagsLib BlogLibrary ">

     


    <xsl:output method="xml" omit-xml-declaration="yes"/>

    <xsl:param name="currentPage"/>

    <xsl:template match="/">

    <xsl:variable name="loggedInTemplate" select="2387" />
    <xsl:variable name="loggedOutTemplate" select="2388" />

    <xsl:variable name="currentId" select="$currentPage/@id" />       
    <xsl:choose>               
     <xsl:when test="umbraco.library:IsLoggedOn()">                 
      <xsl:value-of select="umbraco.library:RenderTemplate($currentId,$loggedInTemplate)" disable-output-escaping="yes" />               
     </xsl:when>               
     <xsl:otherwise>                       
      <xsl:value-of select="umbraco.library:RenderTemplate($currentId,$loggedOutTemplate)" disable-output-escaping="yes" />               
     </xsl:otherwise>       
    </xsl:choose>

    </xsl:template>

    </xsl:stylesheet>

     

  • Tom Maton 387 posts 660 karma points
    Mar 05, 2010 @ 11:14
    Tom Maton
    0

    Try changing

     <xsl:when test="umbraco.library:IsLoggedOn() = true()">   

    Original post by Dougloas Robar

    http://our.umbraco.org/forum/using/ui-questions/3495-umbracolibraryIsLoggedOn%28%29-returns-NullReferenceException

  • Tom Maton 387 posts 660 karma points
    Mar 05, 2010 @ 11:15
    Tom Maton
    0

    Also are there members setup already?

  • curlybub 133 posts 107 karma points
    Mar 08, 2010 @ 03:45
    curlybub
    0

    Hi Tom,

    Yes members are already setup. I'll try your suggestion. 

    Thank you.


    Regards,
    Harry

  • curlybub 133 posts 107 karma points
    Mar 08, 2010 @ 06:47
    curlybub
    0

    Hi Tom,

    It still gives me the same error.

     

  • jaygreasley 416 posts 403 karma points
    Mar 09, 2010 @ 11:24
    jaygreasley
    0

    Hey Harry,

    Do you have Member Types and member groups set up?

    Does this fail when both logged in and not logged in?

    Jay

  • curlybub 133 posts 107 karma points
    Mar 09, 2010 @ 23:42
    curlybub
    0

    It gives me this error when I try to save the xslt that I created. 

Please Sign in or register to post replies

Write your reply to:

Draft