My website allow user to create account.
Upon creating, a email verification with a URL will be send to the user's email.
Problem: The sending of email worked but unfortunately the verification URL did not appear.
And for
<a href="<%VerifyUrl%>"<%VerifyUrl%></a></p>
there is a green curly line beneath "<%VerifyUrl%>", stating that this file could not be found.
File <%VerifyUrl%> was not found
This is the source code of Login.aspx :
protected void CreateUserWizard1_SendingMail(object sender,MailMessageEventArgs e)
{
MembershipUser userInfo = Membership.GetUser(CreateUserWizard1.UserName);
//Construct the verification URL
string VerifyUrl = Request.Url.GetLeftPart(UriPartial.Authority) + Page.ResolveUrl("~/Verify.aspx?ID=" + userInfo.ProviderUserKey.ToString());
// Replace <%VerifyUrl%> placeholder with verifyUrl value
e.Message.Body = e.Message.Body.Replace("VerifyUrl", VerifyUrl.ToString());
}
This is the html file that what user would see in their email:
<h2> Welcome to My Website!</h2>
<p>
Hello, <%UserName%>. You are receiving this email because you recently created a new account at my
site. Before you can login, however, you need to first visit the following link:</p>
<p>
<a href="<%VerifyUrl%>"><%VerifyUrl%></a></p>
<p>
After visiting the above link you can log into the site!</p>
<p>
If you have any problems verifying your account, please reply to this email to
get assistance.</p>
<p>
Thanks!</p>