| 123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100 |
- <%@ WebHandler Language="C#" Class="login" %>
- using System;
- using System.Web;
- using System.Web.Security;
- using System.Web.SessionState;
- using System.Collections.Generic;
- using System.Data;
- using Curtain.DataAccess;
- using DK.XuWei.WebMes;
- using System.IO;
- using System.Net;
- using System.Text;
- public class login : IHttpHandler, IRequiresSessionState
- {
- public void ProcessRequest(HttpContext context)
- {
- context.Response.ContentType = "text/plain";
- if (context.Request["m"].ToString() == "0")
- {
- string accountCode = (context.Request["accountCode"] is object) ? context.Request["accountCode"].ToString() : "";
- string userCode = (context.Request["userCode"] is object) ? context.Request["userCode"].ToString().ToUpper() : "";
- string userPassword = (context.Request["userPassword"] is object) ? context.Request["userPassword"].ToString() : "";
- string sessionKey = (context.Request["sessionKey"] is object) ? context.Request["sessionKey"].ToString() : "";
- bool productCheck = (context.Request["productCheck"] is object) ? Convert.ToBoolean(context.Request["productCheck"].ToString()) : false;
- //如果密码未加密,做MD5加密处理
- if (userPassword.Length != 32) userPassword = FormsAuthentication.HashPasswordForStoringInConfigFile(userPassword, "MD5");
- string result = mes.LoginByPara(accountCode, userCode, userPassword, productCheck).ToJson();
- if (context.Request["go"] is object)
- {
- context.Response.Redirect("/mes/main.html");
- }
- else
- {
- context.Response.Write(result);
- }
- }
- //AD域名校验
- if (context.Request["m"].ToString() == "1")
- {
- ////获取ad验证
- //string url = "http://127.0.0.1:60123/hgws/get_ad_code";
- ////定义一个result用来存放接收到的json数据
- //string result = "";
- ////请求url
- //HttpWebRequest req = (HttpWebRequest)WebRequest.Create(url);
- ////请求方法为Get
- //req.Method = "Get";
- //try
- //{
- // HttpWebResponse resp = (HttpWebResponse)req.GetResponse();
- // Stream stream = resp.GetResponseStream();
- // //获取内容
- // using (StreamReader reader = new StreamReader(stream, Encoding.UTF8))
- // {
- // result = reader.ReadToEnd();
- // }
- //}
- //catch (Exception ex)
- //{
- // JsonResult rs = new JsonResult();
- // rs.success = false;
- // rs.status = 0;
- // rs.message = "验证失败";
- // context.Response.Write(rs.ToJson());
- // return;
- //}
- string result = context.Request["ADresult"];
- JsonResult jr = dkmes.LoginByAD1(result);
- if (jr.success)
- {
- context.Response.Write(jr.ToJson());
- //context.Response.Redirect("/mes/main.html");
- }
- else
- {
- context.Response.Write(jr.ToJson());
- }
- }
- }
- public bool IsReusable
- {
- get
- {
- return false;
- }
- }
- }
|