基于asp.net的登录页面开发

using System;
using System.Collections.Generic;
using System.Linq;
using System.Web;
using BLL;
using LitJson;
using PUB;
namespace XYDWXTWeb.Apis
{
    /// <summary>
    /// moblogin 的摘要说明
    /// </summary>
    public class moblogin : IHttpHandler
    {
        public void ProcessRequest(HttpContext context)
        {
            context.Response.ContentType = "text/plain";
            if (context.Request.HttpMethod == "POST")
            {
                if (context.Request.Form["loginData"] != null)
                {

                    string data = context.Request.Form["loginData"].ToString();
                    string[] strs = data.Split(new char[] { '=', '&' });
                    if (strs.Length >= 4)
                    {
                        string userName = strs[1];
                        string password = strs[3];
                        if (BLL.BLLStudentsInfo.Login(userName, password))
                        {
                             //作为密码方式加密   
                            //   所有公共文件  统一写入PUB项目中  在不同文件中引用
                            string now = DateTime.Now.ToString("yyyyMMddHHmm");
                            string PassCheck = MD5.Encrypt(userName+"&"+now, 32);
                            string info = userName + "&" + password;
                            PermitManger.AddPermit(PassCheck, info);
                            //Results reslt = new Results(200, "T",PassCheck);
                            Results reslt = new Results(200,PassCheck);
                            //reslt.code = 200;
                            //reslt.Msg = "Success";
                            //reslt.data = "{}";
                            string data1 = JsonUnity.ToJson(reslt);
                            context.Response.Write(data1);
                        }
                        else
                        {
                            //Results reslt = new Results(100, "F", "");
                            Results reslt = new Results(210, "");
                            string data2 = JsonUnity.ToJson(reslt);
                            context.Response.Write(data2);
                        }
                    }
                }
            }

        }

        public bool IsReusable
        {
            get
            {
                return false;
            }
        }
    }
}
这段代码中用到了简单的md5加密(折叠),md5只能勉强算是一种加密算法,它只能加密而不能解密

  • 3
    点赞
  • 8
    收藏
    觉得还不错? 一键收藏
  • 0
    评论

“相关推荐”对你有帮助么?

  • 非常没帮助
  • 没帮助
  • 一般
  • 有帮助
  • 非常有帮助
提交
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值