API Questions on Kentico API.
Version 6.x > API > Current document current alias View modes: 
User avatar
Certified Developer 8
Certified Developer 8
majoor-evident - 2/20/2013 6:43:11 AM
   
Current document current alias
Hello,

I've created a node and added an alias to it through properties > URLs > Add new alias. The URL works fine, however when i call CMSContext.CurrentDocument.NodeAliasPath from the alias URL, the value returned is the 'original' alias path. I would expect to see the alias URL. Is there a different variable that i can call to see the current document's current alias?

Regards,
Martijn

User avatar
Kentico Support
Kentico Support
kentico_janh - 2/20/2013 7:16:04 AM
   
RE:Current document current alias
Hello,

The current alias (NodeAliasPath) is always the main one from the top field (Document alias) of that URLs section, so if you want to display a different alias, you need to place your required one to that field instead (the old main one is automatically added as an extra one to that aliases list at tne bottom)

Best regards,
Jan Hermann

User avatar
Certified Developer 8
Certified Developer 8
majoor-evident - 2/20/2013 7:35:25 AM
   
RE:Current document current alias
Thank you for your quick answer.
I found that URLHelper.CurrentRelativePath might also be helpful in my situation.

Regards,
Martijn

User avatar
Kentico Support
Kentico Support
kentico_janh - 2/20/2013 12:54:37 PM
   
RE:Current document current alias
Hello,

I am not so sure. This method should just transform the tilde path to the relative form including a virtual folder like:

"~/Home.aspx" -> "/<virtual_folder>/Home.aspx" -> "/Home.aspx"


Best regards,
Jan Hermann