0
我已將雙因素身份驗證添加到我的移動ASP.Net Web App。當用戶成功輸入他們的用戶名和密碼時,通過電子郵件將密碼發送到他們存儲在數據庫中的電子郵件地址。我遇到的問題是,通知用戶他們沒有定義電子郵件,然後重新加載登錄頁面,但我的代碼沒有通知用戶,而只是重新加載Login.aspx頁面:向用戶顯示消息,然後放棄會話
Private Sub GeneratePin()
Dim r As New Random(System.DateTime.Now.Millisecond)
_Pin = CStr(r.Next(1000, 99999))
_email = CIAppGlobals.CurrentUser.UsrContactEmail
With lblPin
.Text = "PIN has been emailed to the you please check your email now."
End With
If Not String.IsNullOrEmpty(_email) Then
Dim Message As String = " Your Mobile PIN number is " & _Pin & vbNewLine & "From IP Address: " & CIAppGlobals.AppSettings.ClientIP
Tools.SendEmail(CIAppGlobals.CurrentUser.UsrContactEmail, "Mobile App - Two Factor Authentication", Message)
Else
Dim sText As String = "Please contact the Administrator You do not have an email address defined within Application."
'DirectCast(HttpContext.Current.Handler, System.Web.UI.Page).ClientScript.RegisterStartupScript(Me.[GetType](), "test", "alert('" & sText & "')", True)
Response.Write("<script>alert('" & sText & "');</script>")
Thread.Sleep(5000)
'Session.Abandon()
'FormsAuthentication.SignOut()
Response.Redirect(ParentFolder & "/Login.aspx")
End If
End Sub
嗯,這是一個好主意,謝謝! – 2012-01-11 17:53:17