62,046
社区成员
发帖
与我相关
我的任务
分享
namespace MyLogin.Ajax
{
/// <summary>
/// Summary description for LoginHandler
/// </summary>
public class LoginHandler : IHttpHandler
{
public void ProcessRequest(HttpContext context)
{
context.Response.Buffer = true;
context.Response.ExpiresAbsolute = DateTime.Now.AddDays(-1);
context.Response.AddHeader("pragma", "no-cache");
context.Response.AddHeader("cache-control", "");
context.Response.CacheControl = "no-cache";
context.Response.ContentType = "text/plain";
string username = context.Request["username"].ToString();
string password = context.Request["password"].ToString();
//context.Response.Write(password);
//这里怎么进行 数据 库连接 ,请教
if (username == "admin" && password == "1")
{
context.Response.Write("success");
//存储session
}
else
{
context.Response.Write("fail");
}
//context.Response.Write("Hello World");
}
public bool IsReusable
{
get
{
return false;
}
}
}
}