2016-09-08 22 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

相关问题