Dim e As RequestEventArgs = Args(0)
'身份验证,公众号
Dim Openid As String '微信用户Openid
'Dim sb As New StringBuilder
Dim wb As New weui
Dim dt As DataTable
Dim entid As String
Dim pdcode As String
Dim entname As String
Dim paperid As String=e.Cookies("paperid")
'Dim sb As New StringBuilder
If e.GetValues.ContainsKey("paperid") Then
paperid=e.GetValues("paperid")
wb.Appendcookie("paperid",paperid)
End If
If e.host="127.0.0.1" Then
Openid ="otmQFs6MaQBpfCrkihqi_XMw4V4s"
Else
If e.Cookies.ContainsKey("pxopenid") Then '从cookie中获取微信用户id
Openid = e.Cookies("pxopenid")
Else
Dim ul2 As String
If redirectUl="true" Then
ul2 ="http://eso.deqsafety.gov.cn/get-weixin-code.html?appid={0}&scope=snsapi_base&state="+ e.path +"&redirect_uri="+ UrlEncode("http://" & e.host & "/MpRedirect.htm/" )
Else
ul2 ="https://open.weixin.qq.com/connect/oauth2/authorize?appid={0}&redirect_uri="+ UrlEncode("http://" & e.host & "/MpRedirect.htm/" )+ "&response_type=code&scope=snsapi_base&state="+ e.path +"#wechat_redirect"
End If
ul2=CExp(ul2,mpCorpID)
wb.InsertHTML("<meta http-equiv='Refresh' c>") '跳转到授权链接
e.WriteString(wb.Build)
e.Handled = True
Return ""
End If
End If
If openid ="" Then
With wb.AddMsgPage("","msgpage","错误","无效登录")
.icon = "Warn" '改变图标
End With
e.WriteString(wb.Build)
e.Handled = True
Return ""
Else
wb.Appendcookie("pxopenid",openid )
'paperid =e.Cookies("paperid")
End If
If paperid="" Then
With wb.AddMsgPage("","msgpage","错误","参数错误")
.icon = "Warn" '改变图标
End With
e.WriteString(wb.Build)
e.Handled = True
Return ""
End If