Try our conversational search powered by Generative AI!

Loading...
Area: Optimizely CMS

Recommended reading 

Note: This topic has no later version.

Introduction

EPiServer CMS has a number of built in property types to handle string content:

  • PropertyString which earlier versions preferred for short string data.
  • PropertyLongString for general string data, which is now preferred over PropertyString even for short strings. Typed content models default to PropertyLongString for all general string data.
  • PropertyXhtmlString for rich text content (HTML).

Note: Permanent links (links in editor content that are not broken when objects are moved) and dynamic and personalized content are only supported for PropertyXhtmlString.

Recommendations

  • Use PropertyString only if it is already in use for a property (on an upgraded site).
  • Use PropertyLongString for any non-HTML string properties. This could be anything from basic text content or XML to fragments of HTML, like script, that is not allowed in the editor of PropertyXhtmlString. The editor for PropertyLongString defaults to a simple single line input but the code for the typed content model can change it to to use a multi-line input. The code can also define a maximum length for the text (the default is unbounded).
  • Use PropertyXhtmlString for all editor content of type HTML/XHTML.

Properties of type PropertyLongString or PropertyString will be manipulated when rendered using the Property WebControl or the PropertyFor Html helper. This includes conversion of the characters "<>&" to their respective html entities: "&lt;", "&gt;" and "&amp;".  It also ensures that any HTML tags that are not specified in the configuration settings "UISafeHtmlTags" are replaced with the text version of the tags.

For instance, <script> would be replaced with &lt;script&gt; to ensure that script from user input will not be executed on the page. If this behavior is not what you want on your property this would be solved by overriding the ToWebString method on your custom property.

Do you find this information helpful? Please log in to provide feedback.

Last updated: Mar 25, 2013

Recommended reading