Is it possible to set language "automatic" on Url property from code



I have a customer where they have used specific language on their Url properties. They want to change this to "automatic".

Is it possible to do this through code? Im hoping to create a scheduled job to crawl all these properties and change the value.

[Display(Order = 10)]
public virtual Url SomeContent{ get; set; }

Mar 23, 2023 9:15


I think the internal representation of the link will be in the format:

/link/[content GUID].aspx?epslanguage=[content language]

If you want to change the language to automatic, you should be able to remove the querystring from the URL so you've got a URL in the format:

/link/[content GUID].aspx

Mar 23, 2023 10:13

Paul is correct. To get a list of all URL properties with specific language set:

SELECT pkId, String from tblContentProperty 
WHERE fkPropertyDefinitionID IN 
  SELECT pkId from tblPropertyDefinition where fkPropertyDefinitionTypeID IN 
	SELECT pkId from tblPropertyDefinitionType WHERE Name = 'Url'
) AND String LIKE '%?epslanguage=%'
Edited, Mar 23, 2023 10:16

Hi, thanks for quick response!

So if i understand correctly i should try and remove "?epslanguage="{culture}" on all links directly in the database?


Mar 23, 2023 11:44

Database queries are handy for extracting information but I wouldn't recommend changing the data directly in the database. I would suggest using the IContentRepository to update the links to remove the querystring.

Mar 23, 2023 12:06

I couldnt change the actual query directly so I had create a new Url object and store that instead.

So far it seems to work.

var clone = currentPage.CreateWritableClone() as GeneralPageModel;
if (clone != null)
    clone.Video.VideoUrl = new Url(clone.Video.VideoUrl.Path);
    _contentRepository.Save(clone, EPiServer.DataAccess.SaveAction.Publish, AccessLevel.NoAccess);

Edited, Mar 27, 2023 20:35
This topic was created over six months ago and has been resolved. If you have a similar question, please create a new topic and refer to this one.
* 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.