void Page_PreInit(Object sender, EventArgs e) { HttpCookie userInfo; userInfo = Request.Cookies[\"userInfo\"]; Session[\"EmpID\"] = userInfo[\"EmpID\"];
Allow your class to implement IRequiresSessionState such as:
public partial class YOUR_ASPX: System.Web.UI.Page , IRequiresSessionState { // your preinit code }
this is a flag interface which means not need to implement anything but allows you to access Session.