How to check using API if page with given URL exists in the site

Martin Dobsicek asked on June 6, 2009 07:19

How to check using API if page with given URL exists in the site

Correct Answer

Martin Dobsicek answered on June 6, 2009 07:19

You can use following function to find out if page with given full url exists in the site (it returns null if page doesn't exist):

CMS.PortalEngine.PageInfoProvider.GetPageInfoForUrl(...);

0 votesVote for this answer Unmark Correct answer

Recent Answers


Kevin Kamrowski answered on December 4, 2015 20:04 (last edited on December 4, 2015 20:05)

I also found that if your trying to validate a url path against a document or alias in the given site, you can use: CMS.DocumentEngine.PageInfoProvider.GetPageInfoForUrl(url, null, null, true, true, SiteContext.CurrentSiteName);

I tried using CMS.PortalEngine.PageInfoProvider.GetPageInfoForUrl(...); but didn't seem to work. I may have been inheriting the wrong classes though or this changed since in version 9. Just another options!

0 votesVote for this answer Mark as a Correct answer

   Please, sign in to be able to submit a new answer.