Dim fl As String = ProjectPath & "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",".jpeg", ".gif",".png",".bmp",".wmf",".js",".css" ,".html",".htm",".zip",".rar" e.WriteFile(fl) Return '这里必须返回 End Select End If
Dim servip As String = e.request.LocalEndPoint.ToString()
Dim wb As New weui wb.AppendHTML("<style>.weui_grid_icon{width: 40px;height: 40px;}</style>") wb.AppendHTML("<style>.fox_grid_icon{width: 40px;height: 40px;vertical-align: middle;background-size: 40px 40px;}</style>")
'身份验证 If e.Path <> "zc.htm" Then Dim Verified As Boolean '用于标记用户是否通过了身份验证 Dim UserName As String = e.Cookies("username") '从cookie中获取用户名 Dim Password As String = e.Cookies("password") '从cookie中获取用户密码 If e.Path = "logon.htm" '如果是通过登录页面访问,从PostValues即可中提取用户名和密码 If e.PostValues.ContainsKey("username") AndAlso e.PostValues.ContainsKey("password") Then UserName = e.PostValues("username") Password = e.PostValues("password") End If End If Dim usr As DataRow = DataTables("ustbl").SQLFind("usnm = '" & UserName & "'") If usr IsNot Nothing AndAlso usr("uspw") = Password Then Verified = True End If If Verified AndAlso e.Path = "logon.htm" Then '如果用户访问的是登录页,且身份验证成功 Dim userid As String = usr("usid") Dim usernc As String = usr("usnc") wb.AppendCookie("username",UserName) '将用户名和密码写入cookie wb.AppendCookie("password",Password) wb.AppendCookie("userid",userid) wb.AppendCookie("usernc",usernc) 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 End If '开始生成网页 Select Case e.path Case "logon.htm" '登录页面 Functions.Execute("usdenglu",e) Case "exit.htm" '退出登录 Functions.Execute("eixt",e) Case "default.htm" '首页 Functions.Execute("default",e) Case "zc.htm" Functions.Execute("zcym",e) Case "yh.htm" Functions.Execute("yonghu",e) Case "xgmm.htm" Functions.Execute("gaimm",e) Case "xxsc.htm" Functions.Execute("xxsc",e) Case "wdfbxx.htm" Functions.Execute("wdfbxx",e) Case "xxchakan.htm" Functions.Execute("xxchakan",e) Case "xqxx.htm" Functions.Execute("xqxx",e) End Select e.WriteString(wb.Build) '生成网页
|