Virtual Happy Hour this month, Jun 28, we'll be getting a sneak preview at our soon to launch SaaS CMS!

Try our conversational search powered by Generative AI!

Maximum length of Url property



I'm getting the following error when adding an external URL in edit mode that is longer than 255 chars:

Could not save property, and it has been reverted. Please try again.
"Src" has exceeded its limit of 255 characters.


2016-12-08 11:33:13,891 [25] ERROR EPiServer.Cms.Shell.UI.Rest.ContentChangeManager: Unexpected error when updating property src
EPiServer.Core.InvalidPropertyValueException: "Src" has exceeded its limit of 255 characters.
at EPiServer.Core.PropertyString.set_String(String value)
at EPiServer.SpecializedProperties.PropertyUrl.set_String(String value)
at EPiServer.Core.PropertyData.SetPropertyValue(Object value, SetPropertyValueDelegate doSet)
at EPiServer.Cms.Shell.UI.Rest.ContentChangeManager.UpdateProperties(IDictionary`2 properties, IContent content)

I wonder if it is possible to allow Url's that are longer than 255 chars?


Edited, Dec 08, 2016 13:05

The last part of describes how you can configure your site to allow longer urls

Dec 09, 2016 11:34

I've tried adding <httpRuntime maxUrlLength="1024" relaxedUrlToFileSystemMapping="true"/> under <configuration><system.web> in Web.config without any luck. Any other ideas?

Dec 09, 2016 17:09

Any progress?

AFAIK, the maxUrlLength setting is not connected to the MaxLength property of the PropertyUrl class, the 255 character maxlength is inherited from the PropertyString class.

Jan 16, 2017 17:08

After further investigation, it seems the only way is to override the MaxLength property of the PropertyData implementation.

One way to do it is to create a custom backing type, like this.

[PropertyDefinitionTypePlugIn, Serializable]
	public class PropertyUrlWithLength : PropertyUrl {
		public override int MaxLength {
			get {
				var section = ConfigurationManager.GetSection("system.web/httpRuntime") as HttpRuntimeSection;
				return section?.MaxUrlLength ?? base.MaxLength;
			set {
				// Cannot set from code.

And then, on your property declare it like thus:

[Display(Order = 11), BackingType(typeof(PropertyUrlWithLength))]
public virtual Url ButtonUrl { get; set; }

My example uses Johans suggested configuration change to set the length, however, that might not be what you want.

Jan 16, 2017 17:30

Hi there,

Did anyone get any solution this?

I tried all the above solutions and some more by editing web config with following settings. Also added a custom backing type and still the max length of characters I can put in the remaining Url field of Episerver Url property is 407. Need help understanding what am I missing here - 

<httpRuntime targetFramework="4.6.1" requestValidationMode="2.0" enableVersionHeader="false" maxRequestLength="51200" executionTimeout="300" maxUrlLength="10240" relaxedUrlToFileSystemMapping="true" maxQueryStringLength="2097100" />

also tried maxUrlLength - 1024/2048 & maxQueryStringLength-65536 but same output!!

also based on some other references tried below -

<requestLimits maxUrl="30000" maxQueryString="209007151" maxAllowedContentLength="204800000" />

nothing so far!!!

May 24, 2020 14:51

I was able to solve this issue for  CMS version 11.14. Described below is the approach, I used.

  1. Create a LongURL property. 
[PropertyDefinitionTypePlugIn, Serializable]
    public class LongUrl : PropertyUrl
        public override int MaxLength { get; set; } = 2048;

I am overridding max length value to 2048. Default is 255.

2. Create a backing type 

        [Display(GroupName = SystemTabNames.Content, Order = 10)]
        public virtual Url Url { get; set; }
Jul 17, 2020 14:15

@Tanuj: That won't work for URLs above 450 characters, due to the database max length (which may or may not be an issue for you depending on your actual URL requirements).

Proposed a solution here:

Edited, Jul 17, 2020 16:24
* You are NOT allowed to include any hyperlinks in the post because your account hasn't associated to your company. User profile should be updated.