1
Public Sub mainlogin_Authenticate(ByVal sender As Object, ByVal e As System.Web.UI.WebControls.AuthenticateEventArgs) Handles mainlogin.Authenticate
'Are the credentials valid?
If Membership.ValidateUser(mainlogin.UserName, mainlogin.Password) Then
'Has the password expired?
Dim usrInfo As MembershipUser = Membership.GetUser(mainlogin.UserName)
Dim daysSincePwdChange As Integer = Convert.ToInt32(DateTime.Now.Subtract(usrInfo.LastPasswordChangedDate).TotalDays)
If daysSincePwdChange > SecurityUtils.DefaultPasswordExpiryInDays Then
'Password expired, send user to change password
Response.Redirect("~/ChangePassword.aspx?UserName=" & Server.UrlEncode(mainlogin.UserName))
Else
e.Authenticated = True 'Credentials valid & password is current
End If
Else
e.Authenticated = False 'Invalid!
End If
end sub
,但我得到這個錯誤如何改變公衆
錯誤6「System.Web.SecurityUtils」是不是在這種情況下訪問,因爲它是「朋友」。
請記住在標題和標籤中指定編程語言。 – 2011-05-07 07:45:50