asp.net mvc - Umbraco 7 mvc how to get current page id -
I have a custom controller to send a message, so I get the name of the property area and the nickname = "email" Need to do this, it will be used to send email.
This code works below
var Id = umbraco.uQuery.GetNodeByUrl ("/ contact-us"); IPublishedContent root = Umbraco.TypedContent (id.Id); Return route. GETProperty ("email", true). Valal.ToString (); However the problem here is that if the page name changes, the URL will change and the code will be broken. How can I change the above code to the current page ID and put it here (???) ;?
I think the code should be something like this:
IPublishedContent root = Umbraco.TypedContent (???); Return route. GETProperty ("email", true). Valal.ToString (); Any help will be received
Your solution is if you If there is more than one 'contact' node, or none, then you do not know who can be.
(Actually it is found in the node tree first, but then anyone can change their order ...)
Is your controller a surface controller? You can do this:
IPublishedContent currentNode = Umbraco.TypedContent (CurrentPage.Id)
Comments
Post a Comment