I have a site that needs to have role based protected set right from the home page; I tried set it up using standard practice, everything under the home page:
Content -- Home -- Page1 -- ... -- Login -- Not Permitted
However, I can't now secure it because if I secure the Home Page, the login page is secured, and there doesn't seem to be any way of allowing anonymous access on a subnode of a protected node.
Tried adding the rule manually to the web.config but no joy.
Is there any way of doing this, or do I need to move Login directly under the Content node?
Why do you want to get the content node in Razor? It's not an actuall node (although it has id -1 in the db), but more of a placeholder in the tree under which you can create real nodes.
Hmmm, actually, I don't need to for this instance. I was thinking that I needed to have a macro that got content nodes for a menu that worked in the login page and the home page, but as everything will be secured anyway, I don't actually need that.
However, it'd be handy to know for future reference, given a content tree like this:
How would I write a macro that gets all Page document types that can run in both Login and content within Home, and without passing the ID and ideally not the document type of the Home node itself in so the code can be easily reused?
Public access - protecting the home page
I have a site that needs to have role based protected set right from the home page; I tried set it up using standard practice, everything under the home page:
Content
-- Home
-- Page1
-- ...
-- Login
-- Not Permitted
However, I can't now secure it because if I secure the Home Page, the login page is secured, and there doesn't seem to be any way of allowing anonymous access on a subnode of a protected node.
Tried adding the rule manually to the web.config but no joy.
Is there any way of doing this, or do I need to move Login directly under the Content node?
I think that you need to move the Login page under the Content node (or at least not under a node that is protected).
Jeroen
Okay, suspected as much, thanks Jeroen. This would be a very handy feature for a later release though :o)
How the hell do I get the Content Node in Razor?!
Why do you want to get the content node in Razor? It's not an actuall node (although it has id -1 in the db), but more of a placeholder in the tree under which you can create real nodes.
Jeroen
Hmmm, actually, I don't need to for this instance. I was thinking that I needed to have a macro that got content nodes for a menu that worked in the login page and the home page, but as everything will be secured anyway, I don't actually need that.
However, it'd be handy to know for future reference, given a content tree like this:
Content
- Home
- - Page 1
- - Page 2
- - Page 3
- Login
How would I write a macro that gets all Page document types that can run in both Login and content within Home, and without passing the ID and ideally not the document type of the Home node itself in so the code can be easily reused?
What I always do is create a topnode even if you don't need it. So the structure would look like this:
Content
- TopNode
- - Home
- - - Page 1
- - - Page 2
- - - Page 3
- - Login
Because topnode is a real node you can fetch it and get it's children.
If you do this it's good to have umbracoHideTopLevelNodeFromPath in the web.config set to true.
Jeroen
Oh, that's a neat solution, thanks!
By the by, to access the root (or Content) node in razor, you just get the node by Id (-1).
is working on a reply...