<%@ WebHandler Language="C#" Class="wx_scanlogin" %> using System; using System.Web; using System.Net; using Tencent; using eMIS.Data; using System.Data; public class wx_scanlogin : IHttpHandler,System.Web.SessionState.IRequiresSessionState { public void ProcessRequest (HttpContext context) { context.Response.ContentType = "text/plain"; string guid1= context.Request["guid"]; eDbManager manager = new eDbManager(eMIS.Data.WebConfigManager.DefaultDb); eDbOperator dbo = manager.CreateDbOperator(); string sql = ""; try { sql = "select id,userid from xt_wx_scan_login where guid1=?"; DataTable tab = dbo.ExecuteTable(sql, CommandType.Text, guid1); if (tab.Rows.Count == 0) { throw new Exception("请重新打开二维码扫描"); } else { if (Convert.IsDBNull(tab.Rows[0]["userid"])) { context.Response.Write("ok"); } else { dbo.ExecuteNonQuery("update COM_YHB SET lastpwerrtime=NULL WHERE ID=?", tab.Rows[0]["userid"]); eMIS.LoginManager lm = new eMIS.LoginManager(context); lm.Login(Convert.ToString(tab.Rows[0]["userid"])); context.Response.Write("success"); } } } catch (Exception ex) { context.Response.Write(ex.Message); } } public bool IsReusable { get { return false; } } }