WEB用户访问/login.ashx.cs
(完整代码) 1KBusing System;
using System.Collections;
using System.Data;
using System.Linq;
using System.Web;
using System.Web.Services;
using System.Web.Services.Protocols;
using System.Xml.Linq;
using 数据访问与类库;
namespace WEB用户访问
{
/// <summary>
/// $codebehindclassname$ 的摘要说明
/// </summary>
[WebService(Namespace = "http://tempuri.org/")]
[WebServiceBinding(ConformsTo = WsiProfiles.BasicProfile1_1)]
public class login : IHttpHandler
{
public void ProcessRequest(HttpContext context)
{
context.Response.ContentType = "text/plain";
string username = context.Request.Params["username"].ToString();
string password = MD5Helper.ToMD5(context.Request.Params["password"].ToString());
if (DBHelper.ExecuteQuery("select * from WebUser where username='" + username + "' and password='" + password + "'").Tables[0].Rows.Count > 0)
{
//放一个Cookie来指示是哪名用户登陆了
HttpCookie cookie = new HttpCookie("login_name", username);
context.Response.Cookies.Add(cookie);
context.Response.Redirect("index.aspx");
}
else
{
context.Response.Redirect("login.aspx?login_msg=false");
}
}
public bool IsReusable
{
get
{
return true;
}
}
}
}
24 小时内免费解锁 3 个项目,之后 1 积分/个。 规则说明
AI 解读
登录后可用,每次 10 积分,解读结果公开显示在下面。
还没有人解读过这个文件。
