Programmatically creating a dynamic content item. What kind of validation does Sitefinity run on the content?
Sitefinity 6.2.
My code looks something like:
DynamicContent dynamicContent = dynamicModuleManager.CreateDataItem(type);
dynamicContent.SetValue("Content", myHtmlContent);
dynamicModuleManager.Lifecycle.Publish(dynamicContent);
dynamicContent.SetWorkflowStatus(dynamicModuleManager.Provider.ApplicationName, "Published");
dynamicModuleManager.SaveChanges(); // This throws an exception "Length cannot be less than zero. Parameter name: length"
I am migrating a lot of HTML content. Out of over 2500, only 1 triggers an exception. I looked at the HTML and there does not appear to be anything special. I'm guessing maybe the HTML is malformed. But why would Sitefinity try to do anything with the string I'm setting to my field called "Content"?
"Content" field is defined as "Long text" with a "Rich text editor" interface.
Thanks.
It was due to a single opening square bracket in my content as in
<a href="[http
Crazy!
I created a new thread www.sitefinity.com/.../simple-malformed-html-markup-can-break-sitefinity-backend
Please fix this.
Hi Michael,
Actually this is a bug. I have logged it and we will do our best to fix it for the next release.
Sorry for the inconvenience.
Regards,
Nikolay Dimitrov
Telerik
Thanks Nikolay.
Regards,
Michael