이 기사를 기반으로 새 계정을 만들려면 asp.net에서 사용자 만들기 마법사를 사용하려고합니다. www.4guysfromrolla.com/articles/062508-1.aspx, 즉각적인 로그인을 위해 계정을 비활성화하고 보내기 해당 이메일에 등록 후 즉시 확인 이메일을 보내고 모든 것이 잘 작동합니다.이메일 확인 문제가있는 사용자 ID
죄송합니다. 저는 분 대표가 아니고 사진을 업로드 할 수 없으므로 지금은 2 개의 링크 만 제공 할 수 있습니다.
이제 URL을 사용자에게 전송 이메일 USERID 포함 된 문제 :
http://img829.imageshack.us/img829/4410/54303910.png
을 지금 단가 : 여기
그리고 그림과 같이이 데이터베이스에 추가하는 방법입니다 닷넷 구성은 사용자가 비활성화되면 다음과 같이 표시됩니다 :
http://img41.imageshack.us/img41/9286/74707709.png
위 이미지에서 알 수 있듯이 사용자 이름 옆에 체크 표시가 없습니다 (즉, 사용자가 비활성화되어 있고 이메일 확인을 사용하여 계정을 활성화해야 함)
그래서 한 번 클릭하면 그게 내게 그 user is not found in the database
.
나는 정말로이 문제에 곤란을 겪었고 그물에있는 모든 사람들이 나에게 이메일을 보내는 것에 대한 동일한 기사를 보여주었습니다. 그러나 그들 중 누구도 일하지 않았습니다.
아니면 잘못하고 있습니까? 나는 너희 중 몇 사람에 의해 나에게 어떤 빛을 비추고 싶다.
Protected Sub CreateUserWizard1_SendingMail(ByVal sender As Object, ByVal e As System.Web.UI.WebControls.MailMessageEventArgs) Handles CreateUserWizard1.SendingMail
Dim newUserAccount As MembershipUser = Membership.GetUser(CreateUserWizard1.UserName)
Dim newUserAccountId As Guid = DirectCast(newUserAccount.ProviderUserKey, Guid)
Dim domainName As String = Request.Url.GetLeftPart(UriPartial.Authority) + Request.ApplicationPath
Dim confirmationPage As String = "EmailConfirmation.aspx?UserID=" & newUserAccountId.ToString()
Dim url As String = domainName & confirmationPage
e.Message.Body = e.Message.Body.Replace("<%VerificationUrl%>", url)
Dim smtp As New SmtpClient()
smtp.Host = "smtp.gmail.com"
smtp.Port = 587
smtp.UseDefaultCredentials = False
smtp.Credentials = New System.Net.NetworkCredential("[email protected]", "gmailpassword")
smtp.EnableSsl = True
smtp.Send(e.Message)
e.Cancel = True
End Sub
EmailConfirmation.aspx : 여기
이메일을 사용자를 생성 및 전송에 대한 내 코드입니다Protected Sub Page_Load(sender As Object, e As System.EventArgs) Handles Me.Load
'Make sure that a valid querystring value was passed through
If String.IsNullOrEmpty(Request.QueryString("UserID")) OrElse Not Regex.IsMatch(Request.QueryString("UserID"), "[0-9a-f]{8}\-([0-9a-f]{4}\-){3}[0-9a-f]{12}") Then
lblMessage.Text = "An invalid ID value was passed in through the querystring."
Else
'ID exists and is kosher, see if this user is already approved
'Get the ID sent in the querystring
Dim userId As Guid = New Guid(Request.QueryString("UserID"))
'Get information about the user
Dim userInfo As MembershipUser = Membership.GetUser(userId)
If userInfo Is Nothing Then
'Could not find user!
lblMessage.Text = "The user account could not be found in the membership database."
Else
'User is valid, approve them
userInfo.IsApproved = True
Membership.UpdateUser(userInfo)
'Display a message
lblMessage.Text = "Your account has been verified and you can now log into the site."
End If
End If
End Sub