Quantcast
Channel: DevNet Questions
Viewing all articles
Browse latest Browse all 8901

How to get the domain name of the page from which the link originates

$
0
0
Hello, everyone.There are currently three sites with PortalEngine in Kentico 12.0.95.I implemented the following process in Transformation (ASCX format) to get the domain of the link source using the links on the pages of other sites as clues.@script runat=@server@@ protected string SiteTopAlias {set; get;} protected string ImagePath {set; get;} protected string DomainName = @@; protected int NodeID; protected int NodeLinkedNodeID; protected int NodeSiteID; protected override void OnInit(EventArgs e) { NodeID = ValidationHelper.GetInteger(Eval(@NodeID@), 0); CMS.DocumentEngine.TreeProvider tree = new CMS.DocumentEngine.TreeProvider(CMS.Membership.MembershipContext.AuthenticatedUser); CMS.DocumentEngine.TreeNode node = CMS.DocumentEngine.DocumentHelper.GetDocument(NodeID, @global@, true, tree); NodeLinkedNodeID = node.NodeLinkedNodeID; CMS.DocumentEngine.TreeNode originalNode = CMS.DocumentEngine.DocumentHelper.GetDocument(NodeLinkedNodeID, @global@, true, tree); NodeSiteID = 0; if(originalNode != null) { NodeSiteID = originalNode.NodeSiteID; CMS.SiteProvider.SiteInfo siteInfo = CMS.SiteProvider.SiteInfoProvider.GetSiteInfo(NodeSiteID); DomainName = @//@ + siteInfo.DomainName; } However, this implementation method seems to increase the load on the DB and I am wondering if there is a better way to acquire the original domain. Could you give me some advice?

Viewing all articles
Browse latest Browse all 8901

Trending Articles