admin管理员组文章数量:1571380
原帖地址:http://devnet.kentico/Knowledge-Base/API-and-Internals/How-to-get-full-URL-of-particular-document.aspx
To do so, you can try e.g. to get node according to document´s GUID, culture code and site name . Document GUID number (Node GUID) can be found in CMSDesk -> Content -> select document -> Properties -> General , or in database.
First, you need to create new node using:
CMS.TreeEngine.TreeProvider tp = new CMS.TreeEngine.TreeProvider();
TreeNode tn = tp.SelectSingleNode(Guid, CultureCode, SiteName);
Then you can use UrlHelper.ResolveUrl('~' + tn.AliasPath) ;, which returns string with relative path. Then you can use this string as parameter in this method: UrlHelper.GetAbsoluteUrl(String relative URL) which returns an absolute path as you need.
UPDATE for Kentico version 6:
// for example /Home
string aliasPath = CMSContext.CurrentDocument.NodeAliasPath;
string fullURL = URLHelper.GetAbsoluteUrl(URLHelper.ResolveUrl("~" + aliasPath + ".aspx"));
版权声明:本文标题:How to get full URL of particular document 内容由热心网友自发贡献,该文观点仅代表作者本人, 转载请联系作者并注明出处:https://m.elefans.com/xitong/1727689315a1125684.html, 本站仅提供信息存储空间服务,不拥有所有权,不承担相关法律责任。如发现本站有涉嫌抄袭侵权/违法违规的内容,一经查实,本站将立刻删除。
发表评论