Vb.net 如何向公众转变

Vb.net 如何向公众转变,vb.net,properties,friend,public,Vb.net,Properties,Friend,Public,但我犯了这个错误 错误6“System.Web.SecurityUtils”在此上下文中不可访问,因为它是“Friend” 你不能——正如它所说,System.Web.SecurityUtils是不可访问的。你不能把它公之于众——它不是为了公之于众而设计的。改变你的方法,这样你就不需要它了 当然,可能是你真的想引用另一种类型。。。你有没有偶然读过书?我猜这里,SecurityUtils是一个不同的自定义类,而不是System.Web.SecurityUtils 不过,它所做的只是获得网站的默认到

但我犯了这个错误

错误6“System.Web.SecurityUtils”在此上下文中不可访问,因为它是“Friend”


你不能——正如它所说,
System.Web.SecurityUtils
是不可访问的。你不能把它公之于众——它不是为了公之于众而设计的。改变你的方法,这样你就不需要它了

当然,可能是你真的想引用另一种类型。。。你有没有偶然读过书?我猜这里,
SecurityUtils
是一个不同的自定义类,而不是
System.Web.SecurityUtils


不过,它所做的只是获得网站的默认到期日——这可能是您希望以自己的方式实现的事情。它可能只是一个常量,或者是设置文件中的某个内容。这里并没有太多的逻辑。

记住在标题和标记中指定编程语言。
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