2014-6-3 Jquery+ajax+ashx登陆页面

</pre>前台html页面通过JQuery的AJAX方式向ashx页面传递值</p><p>形式如下:</p><p></p><pre name="code" class="javascript">$.post('Service/GetData.ashx', { "username": $("#ipt_username").val(), "userpwd": $("#ipt_userpwd").val(), },

                            //$.post('http://127.0.0.1:3722/users/check', { "username": $("#ipt_username").val(), "userpwd": $("#ipt_userpwd").val() },
                            function (a) {
                                if (a == "True!")
                                {
                                    $.messager.alert('提示', '登录成功!', 'info')
                                    setCookie('username', 'gisera');
                                    formLogin.dialog('close');
                                }
                                else
                                {
                                    $.messager.alert('提示', '登录失败!', 'info');
                                }
                            }
                            )

然后service服务里面的ashx页面获取传入的值,都在HttpContent这个密封静态类中

public void ProcessRequest(HttpContext context)
    {
        context.Response.ContentType = "text/plain";
        string name = context.Request.Form[0];
        string pwd = context.Request.Form[1];
        Common.DEncrypt.EncryptRe pwd1 = new Common.DEncrypt.EncryptRe();
        string b = pwd1.EncryptString(pwd);
        try
        {
            if (GetUserSignIn(name, pwd).Rows[0][0].ToString() == b) //返回验证用户登录的状态 True或False
            {
                context.Response.Write("True!");
            }
            else
            {
                context.Response.Write("False!");
            }
        }
        catch { context.Response.Write("False!"); }
    }

    public static System.Data.DataTable GetUserSignIn(string name, string pwd)
    {
        
    }

    public bool IsReusable
    {
        get
        {
            return false;
        }
    }


附:GetUserSignIn为加密算法 进行匹配,返回输出形式是content.response.write 
返回的值被JQuery中的function(a)中a接收到然后进行判断。
附:64位系统后台通过ado.net连接Oracle出现无法检测到Oracle的情况,比较好的解决办法是在64位系统中装32位oracle,因为PL/sql没有64位版,然后设置环境变量讲oracle的path路径放在最前,然后到oracle目录下添加用户完全控制的权限,重启IIS,重启VS。

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

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

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

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

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

抵扣说明:

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

余额充值