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 logic to read the node templates. while reading the template page throws an error. the actual issue is I have 10-page nodes. while reading those 10 pages using RenderTemplate() the first page only throws the error remaining 9 pages read the page without issue. but overall API result throws 301 sometime throws 500 error. if I ignore that one error page then the API result gives success.how to resolve it?
RenderTemplate() always returns a string if it errors message. kindly give the solution
I am not sure what you mean here. Please can you provide example of your code and point out where the error is happening so we can try help debug it.
Thank you for your time David.
this is my code for reading the template
var **htmlObject** = _umbracoComponentRenderer.RenderTemplate(content.Id);
return htmlObject != null ? htmlObject.ToHtmlString() : null;
i send the content id .it return the HTML string.
for example. , have two content page articles and a product page. article page template doesn't have any errors so it will return the exact document HTML in htmlObject variable.
while reading the article template I didn't check some of the values with the not null condition in it.so it will throw the error.I get the object reference not set an instance of object error in the htmObject variable.
my question is how can I get the differentiate the first and second htmObject variable values.
first one is the correct value, second one is the error string.
is working on a reply...
Write your reply to:
Image will be uploaded when post is submitted