Copied to clipboard

Flag this post as spam?

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


  • Jed 55 posts 80 karma points
    Dec 14, 2011 @ 11:40
    Jed
    0

    asp login name into macro

    I'd like to use the current user's 'asp login name' in a .net macro placed in a template. I'm thinking of something like:

    <umbraco:Macro Alias="macroAlias" runat="server" userName="<% =someFunction() %>"></umbraco:Macro>

    or

    <umbraco:Macro Alias="macroAlias" runat="server" userName="<asp:LoginName />"></umbraco:Macro>

    but I have been unable to find the correct syntax to do this. Any ideas?

  • Rodion Novoselov 694 posts 859 karma points
    Dec 14, 2011 @ 22:26
    Rodion Novoselov
    0

    Hi. I would try this:

    <umbraco:Macro ID="myMacro" Alias="macroAlias" runat="server" />

    <script runat="server">
    void Page_Load() {
        myMacro.MacroAttributes.Add("userName", Page.User.Identity.Name); 
      }
    </script>
Please Sign in or register to post replies

Write your reply to:

Draft