Reputation: 3980
I am using a dictonary to perform a merge code replacment in a email notifcations emails work great but I am having a hell of a time with urls for some reason its not adding the query strings to the url even though the url is well formed.
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);
I just dont c why my paramerters are not being brought through to verifyPassword when i look at the url its stops at .aspx and no query strings in the hyper link
Upvotes: 0
Views: 42
Reputation: 6222
I think your code is faulty;
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));
looks like it should be
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 ));
note - verifyPassword not vertificationUrl in the replace.
Upvotes: 1