📄 index.aspx.vb
字号:
Imports System.Web.Security
Imports System.Configuration
Imports flyangel.article.twotipclass
Public Class article_admin_index
Inherits System.Web.UI.Page
Protected WithEvents login_button As System.Web.UI.WebControls.Button
Protected WithEvents error_message As System.Web.UI.WebControls.Label
Protected WithEvents hide_error_message As System.Web.UI.WebControls.Panel
Protected WithEvents username As System.Web.UI.WebControls.TextBox
Protected WithEvents Requiredfieldvalidator1 As System.Web.UI.WebControls.RequiredFieldValidator
Protected WithEvents Regularexpressionvalidator1 As System.Web.UI.WebControls.RegularExpressionValidator
Protected WithEvents password As System.Web.UI.WebControls.TextBox
Protected WithEvents RequiredFieldValidator As System.Web.UI.WebControls.RequiredFieldValidator
Protected WithEvents RegularExpressionValidator As System.Web.UI.WebControls.RegularExpressionValidator
#Region " Web 窗体设计器生成的代码 "
'该调用是 Web 窗体设计器所必需的。
<System.Diagnostics.DebuggerStepThrough()> Private Sub InitializeComponent()
End Sub
Private Sub Page_Init(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles MyBase.Init
'CODEGEN: 此方法调用是 Web 窗体设计器所必需的
'不要使用代码编辑器修改它。
InitializeComponent()
End Sub
#End Region
Private Sub Page_Load(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles MyBase.Load
'在此处放置初始化页的用户代码
If Session("admin_login_count") > 3 Then
hide_error_message.Visible = True
error_message.Text = "未登陆成功,登陆暂时封锁"
login_button.Enabled = False
End If
If IsPostBack Then
If Request.HttpMethod <> "POST" Then
Response.Write("<script language=JavaScript>{alert('非法方式提交数据,请重新输入!');}</script>")
Response.Write("<script Language=Javascript>javascript:history.go(-1);</script>")
Response.End()
Response.Clear()
End If
End If
End Sub
Private Sub login_button_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles login_button.Click
Dim dpuser As iUserClass = HowToUsingFlyangel.iUserClass(ConfigurationSettings.AppSettings("AssemblyFilePath"))
dpuser.SetDBConnstring = ConfigurationSettings.AppSettings("ConnstringA")
Dim admininfo As AdminUserInfo = dpuser.CheckAdminUserLogin(username.Text, password.Text)
If admininfo.UserName <> "" Then
Session("admin_login_state") = "login"
Session("UserName") = admininfo.UserName
Session("trueName") = admininfo.TrueName
Session("KEY") = admininfo.OsKey
Session("M_id") = admininfo.M_id
Session("typeselect") = admininfo.TypeSelect
FormsAuthentication.SetAuthCookie(admininfo.UserName, False, "/")
Dim MyCookie As HttpCookie = New HttpCookie("UserInfo")
MyCookie.Path = "/"
MyCookie.Expires = System.DateTime.Now.AddHours(2)
MyCookie.Values("UserName") = admininfo.UserName
MyCookie.Values("UserClass") = admininfo.TrueName
MyCookie.Values("UserGroup") = "管理员"
MyCookie.Values("Html_Level") = 1
MyCookie.Values("Upload_Level") = 1
MyCookie.Values("ShengHe_Level") = 1
MyCookie.Values("MonthePlan_level") = 1
Response.Cookies.Add(MyCookie)
Response.Redirect("admin_first.aspx")
Else
hide_error_message.Visible = True
Session("admin_login_count") = Session("admin_login_count") + 1
If Session("admin_login_count") < 4 Then
error_message.Text = "请检查您的帐号和密码是否正确,注意区分字符大小写"
Else
error_message.Text = "你已经三次未登陆成功,登陆暂时封锁"
login_button.Enabled = False
End If
End If
End Sub
End Class
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -