2 zzppz zzppz 于 2013.06.21 09:46 提问

asp.net中Cookie存取问题

Cookie始终存不起是什么原因啊

/// <summary>
/// 管理后台 判断登录
/// </summary>
[Serializable]
public class WebCheckAdminLogin : System.Web.UI.Page, System.Web.SessionState.IRequiresSessionState
{
    public WebCheckAdminLogin()
    {

    }

    protected override void OnPreInit(EventArgs e)
    {
        //先判断Session是否为空
        if (HttpContext.Current.Session[Appconfig.USERINFO] == null)
        {
            //如果为空 再判断Cookies是否为空
            if (CookieBox.CheckUserCookie())
            {
                HttpContext.Current.Session[Appconfig.USERINFO] = CookieBox.GetUserCookie();
            }
            else
            {
                HttpContext.Current.Response.Write(Function.JsonTimeout("登录超时失败", "", "forward", "login.html"));
            }
        }
        else
        {
            HttpContext.Current.Session[Appconfig.USERINFO] = CookieBox.GetUserCookie();
        }
    }
}
Csdn user default icon
上传中...
上传图片
插入图片