INTELLIGENT WORK FORUMS
FOR COMPUTER PROFESSIONALS

Log In

Come Join Us!

Are you a
Computer / IT professional?
Join Tek-Tips Forums!
  • Talk With Other Members
  • Be Notified Of Responses
    To Your Posts
  • Keyword Search
  • One-Click Access To Your
    Favorite Forums
  • Automated Signatures
    On Your Posts
  • Best Of All, It's Free!

*Tek-Tips's functionality depends on members receiving e-mail. By joining you are opting in to receive e-mail.

Posting Guidelines

Promoting, selling, recruiting, coursework and thesis posting is forbidden.

Jobs

Often, a user is required to type i

Often, a user is required to type i

(OP)
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:

CODE --> VB.NET

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: http://localhost:2464/SampleApplication/ResetPasswordVB.aspx?uniqueCode=ee3106b4df694555b4ca6f2727a23dc8

SMTP code here 

How is that link generated, please? How would I begin to code it?

Thanks.

RE: Often, a user is required to type i

I don't understand your question. What is it that you want to do? Is this your code, or are you modifying existing code?

RE: Often, a user is required to type i

(OP)
It's a bit of both, JBenson, thanks for replying.

I just wondered in which format

CODE -->

Dim link As String = builder.Uri.ToString() 
the link is generated - number of characters, etc.

The link above, that is, http://localhost:2464/SampleApplication/ResetPassw... is not mine.

Thanks again.

RE: Often, a user is required to type i

The stringbuilder is building the string.. which is the URL for the link using the VirtualPathUtility
From what I see of your code, it is doing what it is supposed to do. So, what exactly is the problem/question?

Red Flag This Post

Please let us know here why this post is inappropriate. Reasons such as off-topic, duplicates, flames, illegal, vulgar, or students posting their homework.

Red Flag Submitted

Thank you for helping keep Tek-Tips Forums free from inappropriate posts.
The Tek-Tips staff will check this out and take appropriate action.

Reply To This Thread

Posting in the Tek-Tips forums is a member-only feature.

Click Here to join Tek-Tips and talk with other members!

Resources

Close Box

Join Tek-Tips® Today!

Join your peers on the Internet's largest technical computer professional community.
It's easy to join and it's free.

Here's Why Members Love Tek-Tips Forums:

Register now while it's still free!

Already a member? Close this window and log in.

Join Us             Close