关于网站登录的问题!急!
Private Sub Page_Load(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles MyBase.LoadIf Not Page.IsPostBack ThenIf Session("login_num") <> "" Then
P_reg.Visible = False
P_log.Visible = True
L_num.Text = Session("login_num")
L_name.Text = Session("name")
L_tim.Text = Session("tim")
Label1.Text = Session("name")
L_tim.Text = FormatDateTime(Session("tim"), 2) + " " + FormatDateTime(Session("tim"), 4)
Else
P_reg.Visible = True
P_log.Visible = False
End If
End If
End Sub
Sub r_login(ByVal sender As Object, ByVal e As System.EventArgs) 从新登陆按钮事件
Session.RemoveAll()
Session.Clear()
P_reg.Visible = True
P_log.Visible = False
End Sub
Sub close(ByVal sender As Object, ByVal e As System.EventArgs) 退出按钮事件
Session.Clear()
Session.RemoveAll()
Session.Abandon()
Response.Redirect("login.aspx")
End Sub
Sub login(ByVal sender As Object, ByVal e As System.EventArgs)
If pwd.Text = "" Then
Page.RegisterStartupScript("", "<script language=javascript>" & "alert('密码不能为空!');<" & "/script>")
End If
If login_name.Text = "" Then
Page.RegisterStartupScript("", "<script language=javascript>" & "alert('姓名不能为空!');<" & "/script>")
End If
If checkuser() = 1 Then
update_tim()
P_reg.Visible = False
P_log.Visible = True
L_num.Text = Session("login_num")
L_name.Text = Session("name")
Label1.Text = Session("name")
'Label1.Style("clore") = "red"
L_tim.Text = FormatDateTime(Session("tim"), 2) + " " + FormatDateTime(Session("tim"), 4)
Else
Session.RemoveAll()
Page.RegisterStartupScript("", "<script language=javascript>" & "alert('用户名密码不符!');<" & "/script>")
End If
End Sub
Function checkuser() As Integer
Dim strsql As String
Dim flag As Integer
strsql = "select [id],[login_num],[contact_person],[pwd],[log_tim] from [users_reg] where [login_num]='" & login_name.Text & "' and [pwd]='" & pwd.Text & "'"
conn.GetReader(strsql)
Do While conn.myReader.Read
flag = 1
Session("login_num") = conn.myReader.Item("login_num")
Session("name") = conn.myReader.Item("contact_person")
'Session("tim") = conn.myReader.Item("log_tim")
Loop
conn.myReader.Close()
conn.myConn.Close()
Return flag
End Function
这是首页的代码,输入用户名和密码登录登录成功后显示用户的登录信息,在点击退出按钮后页面跳转到login.aspx同时清除了session,但是在login.aspx页单击鼠标右键后退还能退回到登录成功的首页,怎么才能把session全部处理掉呢?请高手指教!着急!!