Copied to clipboard

Flag this post as spam?

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


  • joshpearce 5 posts 24 karma points
    Mar 07, 2011 @ 15:37
    joshpearce
    1

    Access Macro Parameters in Razor Script

    Here's how I did it in IronPython:

    videoUrl = HttpContext.Current.Session["args"]["videoUrl"]

    How's it done in Razor scripts?

     

  • Sebastiaan Janssen 5058 posts 15520 karma points MVP admin hq
    Mar 07, 2011 @ 15:59
    Sebastiaan Janssen
    0

    It should be exactly the same: 

    @{
      var videoUrl = HttpContext.Current.Session["args"]["videoUrl"];
    }
    
    <p>Video Url: @videoUrl</p>

    Or just:

    <p>Video Url: @HttpContext.Current.Session["args"]["videoUrl"]</p>
  • Sebastiaan Janssen 5058 posts 15520 karma points MVP admin hq
    Mar 07, 2011 @ 16:00
    Sebastiaan Janssen
    0

    I don't see any macro parameters by the way, but to access them, have a look at this topic.

  • Jonas Eriksson 930 posts 1825 karma points
    Mar 07, 2011 @ 17:02
    Jonas Eriksson
    0

    Just curious : wasn't that's how it was used in Umbraco previous of v4 ? I remember reading something like that in really old forum posts. In Python I never used anything else but directly as print MyMacroParameter. Btw, just Session["args"] works fine to get the Session-object. Just as Request["nnn"] gets querystring and form post values.

Please Sign in or register to post replies

Write your reply to:

Draft