string strcurcookie; //声明当前cookie变量
strcurcookie=Convert.ToString(Request.Cookies["yhxx"]);
string sKey = stryhlx+stryhbh;string sUser = Convert.ToString(strcurcookie);
// 检查是否存在
if (sUser == null || sUser == String.Empty)
{
HttpCookie mycookie=new HttpCookie("yhxx");
mycookie.Value=sUser;
Response.Cookies.Add(mycookie);
}
else
{
Label3.Text="<h4 style='color:red'>抱歉,您好像已经登录了呀:-(</h4>";
return;
}...
显示未将对象引用设置到对象的实例
我该怎么验证用户是否登陆???
strcurcookie=Convert.ToString(Request.Cookies["yhxx"]);
string sKey = stryhlx+stryhbh;string sUser = Convert.ToString(strcurcookie);
// 检查是否存在
if (sUser == null || sUser == String.Empty)
{
HttpCookie mycookie=new HttpCookie("yhxx");
mycookie.Value=sUser;
Response.Cookies.Add(mycookie);
}
else
{
Label3.Text="<h4 style='color:red'>抱歉,您好像已经登录了呀:-(</h4>";
return;
}...
显示未将对象引用设置到对象的实例
我该怎么验证用户是否登陆???
strcurcookie=Convert.ToString(Request.Cookies["yhxx"]);改成
string strcurcookie = Request.Cookies["yhxx"].Value;
{
//没登录
}
else
{
sUser = Request.Cookies["yhxx"].Value
}
string strcurcookie = Request.Cookies["yhxx"].Value;未将对象引用设置到对象的实例。
行 203: {
行 204: string strcurcookie; //声明当前cookie变量
行 205: strcurcookie=Request.Cookies["yhxx"].Value;
行 206:
行 207: string sKey = stryhlx+stryhbh;是不是需要在顶部声明啊? 在using那??