2014-10-16 39 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