By default ​​Response.Redirect​​ terminates thread execution and there might be a race conditions in setting session variables. It is described in article ​​Don't redirect after setting a Session variable (or do it right)​​, so try to use another, less violent version:

Response.Redirect("cpanel.aspx", false);


如果需要troubleshooting的话,可以打印HttpContext.Current.Session.SessionID来验证

 

另外如果代码中,重置了session的话。也会导致session中的数据丢失

 Response.Cookies.Add(new HttpCookie("ASP.NET_SessionId", string.Empty));