Calling Memeber methods from C# embedded in XSLT Options
met67
Posted: Thursday, October 04, 2007 11:02:57 PM

Rank: Devotee

Joined: 9/4/2007
Posts: 36
Location: Rome
Hi,

I am trying to call methods of the Member class from within a C# function embedded in an XSLT file,
but I can't get it working.
I have read from Microsoft docs http://msdn2.microsoft.com/en-us/library/533texsx(vs.71).aspx
that I have to use fully qualified class names, but it still fails.

Does anybody succeded in this?
I would prefer not to use a dll to extend umbraco...

TIA,
Marco Lusini


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:msxsl="urn:schemas-microsoft-com:xslt"
    xmlns:umbraco.library="urn:umbraco.library"
    xmlns:pcm="urn:pcm-it:xslt"
    exclude-result-prefixes="msxml umbraco.library">

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

<xsl:param name="currentPage"/>

<xsl:template match="/">

<!-- start writing XSLT -->

<xsl:value-of select="pcm:Test()"/>

</xsl:template>

<msxsl:script language="C#" implements-prefix="pcm">
  <!-- [CDATA[

    public string Test()
    {
       if ( umbraco.cms.businesslogic.member.Member.IsLoggedOn() )
         return "Cips";
       else
         return "Ciaps";
    }

  ]] -->
  </msxsl:script>
</xsl:stylesheet>
Ronnie
Posted: Friday, October 05, 2007 9:19:32 AM
Rank: Devotee

Joined: 7/19/2006
Posts: 31
umbraco has this exstension method umbraco.library:IsLoggedOn(), cant you use this?

if not There is an article on it, on umbracoWiki on how to do that
you can try out

but I rather use my own exstenion methods
http://en.wikibooks.org/wiki/Umbraco/Create_xslt_exstension_like_umbraco.Library_in_C">http://en.wikibooks.org/wiki/Umbraco/Samples_and_Articles/XSLT/Extend_Xsl
you can try out

but I rather use my own exstenion methods
http://en.wikibooks.org/wiki/Umbraco/Create_xslt_exstension_like_umbraco.Library_in_C



.NET/Umbraco developer @ ebita ApS
met67
Posted: Friday, October 05, 2007 12:01:33 PM

Rank: Devotee

Joined: 9/4/2007
Posts: 36
Location: Rome
Ach, wrong example...

what I am actually trying to achieve is logging in a member via XSLT, without using memebercontrols.

In order to authenticate a member, I must call the GetMemberFromLoginNameAndPassword() method, which is not included in umbraco.library, but I can't get it to work within C# embedded in XSTL.

As I told you I would prefere not to create and install a new DLL on the server...

Marco
Users browsing this topic
Guest


You cannot post new topics in this forum.
You cannot reply to topics in this forum.
You cannot delete your posts in this forum.
You cannot edit your posts in this forum.
You cannot create polls in this forum.
You cannot vote in polls in this forum.