sub login_click(sender as object, e as eventargs)
if username.text="" or userpass.text="" then
response.write("<script language='javascript'>alert('请输入完整的登陆信息!')<" & chr(47) & "script>")
else
dim theuserpass as string
theuserpass=formsauthentication.hashpasswordforstoringinconfigfile(userpass.text,"SHA1")
dim strcnn as string=system.configuration.configurationsettings.appsettings("strcnn")
dim strsql as string="select username,userpass from usersheet where username='" & username.text & "' and userpass='" & theuserpass & "'"
dim cmd as oledbcommand
dim cnn as oledbconnection
dim dr as oledbdatareader
cnn=new oledbconnection(strcnn)
cnn.open()
cmd=new oledbcommand(strsql,cnn)
dr=cmd.executereader()
if dr.read()
dim cookie as httpcookie=new httpcookie("sitecookie")
cookie.values.add("mycookie",dr.getstring(0).tostring())
response.appendcookie(cookie)
response.redirect("user_admin.aspx")
else
response.write("<script language='javascript'>alert('您输入的密码,帐号不对,请重新输入!')<" & chr(47) & "script>")
end if
cnn.close()
cnn=nothing
dr=nothing
cmd=nothing
end if
end sub
sub register_click(sender as object, e as eventargs)
response.redirect("register.aspx")
end sub