API
Version 7.x > API > Get Document alias from URL View modes: 
User avatar
Member
Member
beau.cowan-rrpartners - 2/18/2014 11:49:00 AM
   
Get Document alias from URL
In one of our sites, we are getting related content through an ajax call where the url is the sent to the file. I'm currently assuming that the url is the alias of the document, which obviously isn't always the case, and I need to resolve this by finding a way to match the URL provided to search for the proper document node/alias.

I've been trying to find something in the Developer's Guide that helps in this, but I have been unsuccessful thus far. Can someone help point me in the right direction?

User avatar
Kentico Support
Kentico Support
kentico_filipl - 2/24/2014 7:06:14 AM
   
RE:Get Document alias from URL
Hello Beau,

I can think of 3 possibilities how you can find the matching document for a specific URL:
1. URL consists of the actual document name; stored in TreeNode.DocumentName property
2. URL is made of a custom URL path -> TreeNode.DocumentUrlPath
3. Document alias is used -> CMS_DocumentAlias table
4. URL redirection is set for the document -> TreeNode.DocumentMenuRedirectUrl

All this information can be retrieved using API or SQL queries over respective tables where this information is stored. You can then process them any way you need to achieve your goals.

Best regards,
Filip Ligac