chy710 - 2008-6-26 11:21:00
protected void Page_Init(object sender, EventArgs e)
{
HttpCookie cookie = Request.Cookies["dnt"];
if (cookie != null)
{
string username = null;
if (cookie.Values["userName"] == null)
{
username = Users.GetUserName(int.Parse(cookie.Values["userid"].ToString()));
cookie.Values["userName"] = Server.HtmlEncode(username);
}
else
username = cookie.Values["userName"].ToString();
//...
}
}
上面红色一句出错,提示Object reference not set to an instance of an object.
chy710 - 2008-6-26 11:24:00
不明白,dnt的cookie里为什么不存用户名,密码都存了,还不存用户名?