2016-09-08 48 views
0

我正在使用dictonary在電子郵件通知中執行合併代碼替換電子郵件工作很好,但由於某種原因,我有一段時間與urls無法添加查詢字符串到網址,即使網址格式良好。設置爲電子郵件正文時不添加查詢字符串的URL

Dictionary<string, string> stringsToReplace = new Dictionary<string, string>(); 

stringsToReplace.Add("{method}", method); 
stringsToReplace.Add("{full_name}", fullname); 
stringsToReplace.Add("{ipaddress}", GetIPAddress()); 
stringsToReplace.Add("{query}", queryMessage); 
stringsToReplace.Add("{address}", address); 
stringsToReplace.Add("{user_name}", fullname); 
stringsToReplace.Add("{iva_ref}", caseRef); 
stringsToReplace.Add("{case_ref}", caseRef); 
stringsToReplace.Add("{optout}", OptionsText); 
stringsToReplace.Add("{regemail}", OptionsText); 

string linkreset = "<a href= '" + DomainUrl + "?email=" + customerEmail + "&uid=" + userId + "'> Reset Password" + "<a/>"; 
stringsToReplace.Add("{email}", customerEmail.ToString()); 

stringsToReplace.Add("{reset_link}", string.Format("Please click the link below to reset your password <br /> {0}", linkreset)); 

string verifyPassword = "<a href= '" + verificationUrl + "?email=" + customerEmail + "&uid=" + userId + "'> Verify Password" + "<a/>"; 

stringsToReplace.Add("{verification_link}", string.Format("Please click the link below to verify your password <br /> {0}", verificationUrl)); 

bodyMessage = bodyMessage.MultipleReplace(stringsToReplace); 

我只是不ç爲什麼我的paramerters不被通過帶到verifyPassword當我看網址的停在的.aspx,沒有查詢字符串中的超鏈接

+0

你確定你需要在地圖上的鍵{}嗎? –

+0

嗨其他地圖工作的罰款鮑勃,所以他們是我認爲它的東西與我的報價使用{}鍵解析文本存儲在db字段 – rogue39nin

+0

存儲在012UR是textURL空白嗎?它不應該被linkreset?我看不到你在哪裏添加verifyPassword到任何東西 –

回答

1

我覺得你的代碼是錯誤的;

string verifyPassword = "<a href= '" + verificationUrl + "?email=" + customerEmail + "&uid=" + userId + "'> Verify Password" + "<a/>"; 

stringsToReplace.Add("{verification_link}", string.Format("Please click the link below to verify your password <br /> {0}", verificationUrl)); 

看起來應該是

string verifyPassword = "<a href= '" + verificationUrl + "?email=" + customerEmail + "&uid=" + userId + "'> Verify Password" + "<a/>"; 

stringsToReplace.Add("{verification_link}", string.Format("Please click the link below to verify your password <br /> {0}", verifyPassword)); 

注 - verifyPassword不vertificationUrl的替代。

+0

嗯我得到你沒有大聲笑我怎麼會錯過 – rogue39nin

+0

到今天晚些時候男人謝謝 – rogue39nin

相關問題