2014-10-16 59 views
0

我想获得一个完全合格的网址,这里是代码GetFullUrl不返回完整的URL - Sitecore的

string path = string.Format("/sitecore/shell/Applications/Content%20Manager/default.aspx?id={0}&la={1}&fo={0}", contentItem.ID, contentItem.Language); 

     string fullPath = Sitecore.Web.WebUtil.GetFullUrl(path); 
     text = text.Replace("$itemUrl$", fullPath); 

这将返回这样的事情http://cp.localsite/sitecore/shell/Applications/Content%20Manager/default.aspx?id= {DC6B4AE0-929D,4F19-97F4-825796A30781 } & la = en & fo = {DC6B4AE0-929D-4F19-97F4-825796A30781} 这就像一个链接生成,直到?id =从id看起来像一个正常的文本。我如何解决这个问题。我想要内容的可点击网址。我非常感谢任何帮助。

谢谢。

回答

0

你能否给我提供一些关于你想要实现的更多背景。所描述的行为是正确的,但显然不是你希望实现的。

更新:

看起来你是在正确的轨道上,我发现的唯一的事情是,你真的可以只使用FO查询字符串,以获得正确的项目跑不掉,你也可以用其他的在这里提到的Custom email notification with link - sitecore以获得更具体的。

由于在id =处被切断的URL是文本解析器可能不喜欢卷发器,请尝试编码该URL并查看是否有效。

text = HttpUtility.UrlEncode(text); 
+0

在用户提交内容的工作流步骤中,我正在向批准者发送电子邮件通知。我正尝试发送电子邮件中的内容项目链接。我尝试了其他几种方式,请参阅http://stackoverflow.com/questions/26219873/custom-email-notification-with-link-sitecore – Newbie 2014-10-16 16:50:16

+0

我试过编码字符串path = string.Format(“/ sitecore/shell /Applications/Content%20Manager/default.aspx?id={0}&la={1}&fo={0}“,contentItem.ID,contentItem.Language); string encodedPath = System.Web.HttpUtility.UrlEncode(path); string fullPath = Sitecore.Web.WebUtil.GetFullUrl(encodedPath); text = text.Replace(“$ itemUrl $”,fullPath);但这 – Newbie 2014-10-16 18:06:47

+0

连续的评论....链接似乎没有工作......出来这样的事情是这样的http://cp.localsite/%2fsitecore%2fshell%2fApplications%2fContent%2520Manager%2fdefault.aspx%3fid%3d %7bDC6B4AE0-929D-4F19-97F4-825796A30781%7d%26la%3den%26fo%3d%7bDC6B4AE0-929D-4F19-97F4-825796A30781%7d – Newbie 2014-10-16 18:10:02