您的位置:首页 > Web前端 > JQuery

完整的 dataType=text/plain jquery ajax 登录验证

2014-09-25 09:29 330 查看
Html:

using System;
using System.Collections.Generic;
using System.Linq;
using System.Web;
using System.Web.Security;
using System.Runtime.Serialization;
using Newtonsoft.Json;
using Newtonsoft.Json.Converters;

namespace Sales.Web.url
{
/// <summary>
/// LoginHandler 的摘要说明
/// </summary>
public class LoginHandler : IHttpHandler
{
public void ProcessRequest(HttpContext context)
{
context.Response.ContentType = "text/plain";
try
{
if (HttpUtility.UrlDecode(context.Request["name"] ?? "") == "用户名" && (context.Request["password"] ?? "").ToLower() == FormsAuthentication.HashPasswordForStoringInConfigFile("123456", "MD5").ToLower())
{
context.Response.Write("true");
}
else
{
context.Response.Write("false");
}
}
catch (Exception ex)
{
context.Response.Write(ex.Message);
}
finally
{
context.Response.End();
}
}

public bool IsReusable
{
get
{
return false;
}
}
}
}


Ashx
内容来自用户分享和网络整理,不保证内容的准确性,如有侵权内容,可联系管理员处理 点击这里给我发消息
标签: