下面是“无刷新登录”的例子,采用Ashx+jQuery Ajax实现。
//后台实例代码 ashx文件(可替换为从数据库中读取)
public void ProcessRequest(HttpContext context)
{
context.Response.ContentType = "text/plain";
//context.Response.Write("Hello World");
string name = context.Request.Params["name"].ToString().Trim();
if ("china".Equals(name))
{
context.Response.Write("1");//1标志login success
}
else
{
context.Response.Write("0");//0标志login fail
}
}
//前台实例代码 aspx文件
<html xmlns="http://ww