Try our conversational search powered by Generative AI!

Determining whether a page exists

Vote:
 

Hi

This may have been requested in the past but I thought I would request it anyway.

I have always found it a bit odd that there is nothing available via the API to determine whether a page actually exists.

Many times I have found myself sticking a DataFactory.Instance.GetPage call within a try catch block to check whether a PageNotFoundException occurs.

I have worked on projects that have page list properties which link to other pages in the site.  Some of the pages that these properties refer to may be deleted for some reason and potentially cause the page to fall over, to cope with this I would use the try catch method above.

Would it not be possible to add a method to the DataFactory.Instance class named PageExists or something similar which accepts a page reference and returns a boolean?  I know throwing and catching exceptions can be expensive and it just seems a bit unnecessary to me.

Regards

Lee

 

#46059
Nov 25, 2010 14:46
Vote:
 

Running into the same situation. Any reply from EPiServer on this matter?

#51233
May 30, 2011 9:57
Vote:
 

+1

#51243
May 30, 2011 12:52
This thread is locked and should be used for reference only.
* 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.