Dim fl As String = "d:\web\" & e.path
If filesys.FileExists(fl)
Dim idx As Integer = fl.LastIndexOf(".")
Dim ext As String = fl.SubString(idx)
Select Case ext
Case ".jpg",".gif",".png",".bmp",".wmf",".js",".css" ,".html",".htm",".zip",".rar"
e.WriteFile(fl)
Return '这里必须返回
End Select
End If
Dim wb As New weui
'身份验证
Dim Verified As Boolean '用于标记用户是否通过了身份验证
Dim UserID As String = e.Cookies("userid") '从cookie中获取用户名
Dim PassWord As String = e.Cookies("password") '从cookie中获取用户密码
If e.Path = "logon.htm" '如果是通过登录页面访问,从PostValues即可中提取用户名和密码
If e.PostValues.ContainsKey("userid") AndAlso e.PostValues.ContainsKey("password") Then
UserID = e.PostValues("userid")
PassWord = e.PostValues("password")
End If
End If
'验证密码
Dim cmd As New SQLCommand
Dim dt As DataTable
Dim dr As DataRow
cmd.ConnectionName = DataSource
cmd.CommandText = "Select * F rom {用户管理} Where [用户编号] = '" & UserID & "'"
dt = cmd.ExecuteReader
If dt.DataRows.Count > 0 Then
dr=dt.DataRows(0)
If PassWord=DecryptText(dr("登录密码") ,"zhy","823") Then
Verified = True
End If
End If
If Verified AndAlso e.Path = "logon.htm" Then '如果用户访问的是登录页,且身份验证成功
wb.AppendCookie("userid",UserID) '将用户名和密码写入cookie
wb.AppendCookie("password",PassWord)
wb.AppendCookie("DepName",dr("部门名称"))
wb.InsertHTML("<meta http-equiv='Refresh' c>") '直接跳转到首页
e.WriteString(wb.Build) '生成网页
Return '必须的
ElseIf Verified = False AndAlso e.Path <> "logon.htm" Then '如果用户身份验证失败,且访问的不是登录页面
wb.InsertHTML("<meta http-equiv='Refresh' c>") '那么直接跳转到登录页面
e.WriteString(wb.Build) '生成网页
Return '必须的
End If
'开始生成网页
Select Case e.path
Case "logon.htm" '登录页面
Functions.Execute("Weblogon",e)
Case "exit.htm" '退出登录
Functions.Execute("Webexit",e)
Case "", "default.htm" '首页
Functions.Execute("Webdefault",e)
Case "salestargetquery.htm" '目标达成查询
Functions.Execute("SalestargetQuery",e)
Case "salestargetlist.htm" '目标达成清单
Functions.Execute("SalestargetList",e)
Case "getdata.htm" '目标达成清单
Functions.Execute("Getdata",e)
Case "fsrsedit.htm"
If e.PostValues.Count > 0 Then
Functions.Execute("WebfsrsSave",e) '保存表单数据
End If
Functions.Execute("WebfsrsEdit",e) '生成订单编辑页面
End Select
e.WriteString(wb.Build) '生成网页