Try our conversational search powered by Generative AI!

Find pages by URLSegment

Vote:
 

I´ve done some testings, but with no success. Is it possible to search by URLSegment?

PropertyCriteria criteria = new PropertyCriteria();
criteria.Condition = EPiServer.Filters.CompareCondition.Equal;
criteria.Name = "URLSegment";
criteria.Type = PropertyDataType.String;
criteria.Value = "test";

PropertyCriteriaCollection criterias = new PropertyCriteriaCollection();
criterias.Add(criteria);

 

 

 

#29174
Apr 14, 2009 11:04
Vote:
 

Hi!

I've not tested it, but try using the following instead:

criteria.Name = "PageURLSegment"

All built in properties are prefixed with "Page".

Regards

Per Gunsarfs
EPiServer CMS Development team

 

#29177
Apr 14, 2009 11:42
Vote:
 
Doesn´t work. But now it returns all pages instead so something happens.
PropertyCriteria criteria = new PropertyCriteria();
criteria.Condition = EPiServer.Filters.CompareCondition.Equal;
criteria.Name = "PageURLSegment";
criteria.Type = PropertyDataType.String;
criteria.Value = "test";
criteria.Required = true;

Is there another way to achieve this? I´m building a cross publishing plugin and a custom url rewriter.
So the page can have more than one url, e.g. example.com/archive/test/ (original url) and example.com/another-page/archive/test/ (custom url).
My problem is to convert the second url to an internal address. Now I´m truncating the second url to example.com/another-page/archive/ (the archive page exists on this url) and then try to find tha page "test" under example.com/archive/ and convert it to /templates/archive.aspx?id=1&articleId=2.
Today I´m using the method ConvertToInternal() to find the page using the orginal url to the archive where the page is published to and then add the url segment. But that doesn´t work if the we have another structure under  example.com/archive/ than a flat structure, e.g. example.com/archive/2008/01/test/. 
#29181
Apr 14, 2009 13:42
Vote:
 
Solved it by adding the same structure to both url's. E.g. exampel.com/archive/2008/01/test/ and exampel.com/another-page/archive/2008/01/test/.
#29187
Apr 14, 2009 16:01
This thread is locked and should be used for reference only. Please use the Episerver CMS 7 and earlier versions forum to open new discussions.
* 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.