在类库中获取cookie值
我的代码是:
using System;
using System.Collections.Generic;
using System.Text;
using System.Web;
using System.Web.SessionState;
using System.Web.UI;
namespace BLL
{
public class Load
{
/// <summary>
/// 判断用户密码是否正确
/// </summary>
/// <returns></returns>
public bool judge()
{
bool i;
//HttpRequest Request = new HttpRequest(); 这里有错不知道咋解决,引用都已经添加了 HttpCookie cookie =Request.Cookies["user"];
if (cookie != null)
{
Model.Load load = new Model.Load();
DAL.Load loadDal = new DAL.Load();
if (load._code == cookie["yanzhenma"])
{
string pwd = loadDal.GetPwd();
if (pwd == load._pwd)
i = true;
else
i = false;
}
}
else
i = false;
return i;
}
}
}