protected void Page_Load(object sender, EventArgs e) { if (!IsPostBack) { if (!Request.IsAuthenticated) { FormsAuthentication.RedirectToLoginPage(); } else { if (Session["sessionId"] == null) { Response.Redirect("index.aspx"); } else { FormsAuthenticationTicket ticket = (FormsAuthentication.Decrypt(Session["auth"].ToString())); string userId = ticket.UserData.Split(';')[0]; string role = ticket.UserData.Split(';')[1]; if (Session["sessionId"] == null) { SessionCL sessionCL = sessionBLL.addorCheckSession(); Session["sessionId"] = sessionCL.id; } else if (role.ToLower() == "teacher" || role.ToLower() == "attendanceo") { Response.Redirect("../UnAuthorized.aspx"); } else { sessionId = Convert.ToInt32(Session["sessionId"]); ViewState["examination"] = grdExamination.DataSource = examinationBLL.viewExaminations(sessionId); grdExamination.DataBind(); } } } } }