Often, a user is required to type in his email address in the case of a forgotten password. A message is sent to that address with a link for the user to click on in order to reset his password. I have something like this:
How is that link generated, please? How would I begin to code it?
Thanks.
Code:
Using conn As New OleDbConnection(ConnectionString)
Using cmd As OleDbCommand = conn.CreateCommand()
cmd.CommandText = "UPDATE university SET uniqueCode = @uniqueCode WHERE strEmail = @strEmail"
cmd.Parameters.AddWithValue("@uniqueCode", uniqueCode)
cmd.Parameters.AddWithValue("@strEmail", strEmail.Text.Trim())
conn.Open()
Dim recordsAffected As Integer = cmd.ExecuteNonQuery()
If recordsAffected <> 0 Then recordExists = True
End Using
End Using
If recordExists Then
Dim builder As New UriBuilder(Request.Url)
builder.Path = VirtualPathUtility.ToAbsolute("~/resetPwd.aspx")
builder.Query = "uniqueCode=" & HttpUtility.UrlEncode(uniqueCode)
Dim link As String = builder.Uri.ToString()
' Eg: [URL unfurl="true"]http://localhost:2464/SampleApplication/ResetPasswordVB.aspx?uniqueCode=ee3106b4df694555b4ca6f2727a23dc8[/URL]
SMTP code here
How is that link generated, please? How would I begin to code it?
Thanks.