Press Ctrl / CMD + C to copy this to your clipboard.
This post will be reported to the moderators as potential spam to be looked at
I have a multisite solution and each site has it's own settings folder. The problem I have is that inside a /base method, I need to read some settings for the current site I'm in, but I coudn't yet figure a way to retrieve the root node.
Usually when a normal page is requested, I can find which is the root node for the current site, starting from Node.GetCurrent().Path. (where the second id in the path string is the id of the root node in current site). And once I have root node I can find the settings for that site.
But when a /base method is called, there is no context node, so Node.GetCurrent() is, of course, crashing. How can I find my root node in this case?
How about passing the Current ID (or Root ID) into the /Base method ?
Yes, that could be a workaround, but not the most elegant one I was hoping for as I would have to alter all ajax methods logic and make sure to always handle an id parameter. I was hoping for a more elegant way similar to Node.GetCurrent() in the normal page request.
Surely, there must be a way, since umbraco is also resolving urls to nodes somehow for a specific site, so it has to be aware of the root node at some point.
Another way I thought about was to iterate all level 1 nodes, and take the first node matching the value of HttpContext.Current.Request.Url.Host. Not sure though if this way is safe enough.
I found a post here:
that might be what you're after, or at least point you in the right direction.
is working on a reply...
Write your reply to:
Image will be uploaded when post is submitted