我有一个运行良好的 LoginControl,但是,我希望它存储更多信息,而不仅仅是是否经过身份验证。我想存储用户的 UserID,这样当他们进行更改时,我可以调用该 UserID 并记录他们进行了更改。
这是我的代码。
Dim db As New DataClassesDataContext
Dim User = (From UserTable In db.Users _
Select UserTable _
Where UserTable.Active = True And _
UserTable.Name = LoginControl.UserName And _
UserTable.Password = RC.CryptedText _
)
If User.Count = 1 Then
e.Authenticated = True
Else
e.Authenticated = False
End If
我只是想稍后能够调用 UserID,我能够正常登录和访问页面,但是类似
Session("UserID") = LoginControl.UserName
只要 session 没有被清除就太好了。
最佳答案
试试这个可能对你有帮助。
http://www.c-sharpcorner.com/UploadFile/syedshakeer/1789/ http://www.15seconds.com/issue/020220.htm http://www.exforsys.com/tutorials/asp.net-2.0/forms-authentication-in-asp.net-2.0.html
关于asp.net - 如何使用 LoginControl 存储 UserID 和 Name?,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/3877522/