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
Hello,
Can anyone tell me if it's possible to view the list of domains added via the 'Culture and Hostnames' in C# preferably strongly typed.
I need to loop through all top root level pages and do a domain check.
Thanks
Paul
Here's a snippet of code I have that does similar:
var contentCache = context.ContentCache; var services = ApplicationContext.Current.Services; var domainService = services.DomainService; // Get homepages. return domainService // First, get each content node with a domain set. .GetAll(true) .Select(x => new { x.DomainName, x.RootContentId, Node = contentCache.GetById(x.RootContentId.Value) }) // Avoid null exceptions. .Where(x => x.Node != null);
I'm sure you can figure out the rest from that.
Legend.
Thanks Nicholas :-)
Hello Nicholas,
var contentCache = context.ContentCache;
throws an error. Secondly, in which type of file to implement this. Is it .cshtml or .cs?
Hi Mangirish,
This thread has already been answered. Please ask that question in a new thread. Be sure to mention details (e.g., where you tried to use that line, what error you got, if it was a compile or runtime error, a screenshot, and so on).
is working on a reply...
Write your reply to:
Upload image
Image will be uploaded when post is submitted
Getting domain values from Cultures and Hostnames
Hello,
Can anyone tell me if it's possible to view the list of domains added via the 'Culture and Hostnames' in C# preferably strongly typed.
I need to loop through all top root level pages and do a domain check.
Thanks
Paul
Here's a snippet of code I have that does similar:
I'm sure you can figure out the rest from that.
Legend.
Thanks Nicholas :-)
Hello Nicholas,
throws an error. Secondly, in which type of file to implement this. Is it .cshtml or .cs?
Hi Mangirish,
This thread has already been answered. Please ask that question in a new thread. Be sure to mention details (e.g., where you tried to use that line, what error you got, if it was a compile or runtime error, a screenshot, and so on).
is working on a reply...