Copied to clipboard

Flag this post as spam?

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


  • Rob Watkins 369 posts 701 karma points
    Mar 28, 2011 @ 18:35
    Rob Watkins
    0

    Custom section / master pages

    I am creating a custom section to manage products. I am basing my pages on the umbracoPage.master, and inheriting from UmbracoEnsuredPage - all of this is working perfectly.

    However, I'm having a bit of a Monday Moment trying to use my own master pages; I want to create a master page which sets up the chrome and stylesheets / scripts for the whole of this custom section, then base the pages on that.

    The fly in the ointment is that part of the UI is an UmbracoPanel to display the "Welcome Username" message so the section fits in with the rest of the backend.

    If I inherit my master page from UmbracoEnsuredPage to access the current user I get an error, as UmbracoEnsuredPage is based on System.Web.UI.Page, not System.Web.UI.MasterPage.

    If I inherit from System.Web.UI.MasterPage I have no access to CurrentUser.

    Am I missing some obvious way to achieve what I want?

  • Daniel Bardi 927 posts 2562 karma points
    Mar 28, 2011 @ 19:44
    Daniel Bardi
    1

    you can get current user from any where like this:

    var currentUser = umbraco.BusinessLogic.User.GetCurrent();
  • Rob Watkins 369 posts 701 karma points
    Mar 29, 2011 @ 10:52
    Rob Watkins
    0

    Perfect, thanks Daniel.

  • Daniel Bardi 927 posts 2562 karma points
    Mar 29, 2011 @ 11:10
    Daniel Bardi
    0

    You are most welcome!

Please Sign in or register to post replies

Write your reply to:

Draft