protected void Page_Load(object sender, EventArgs e) { var user = Page.User as CustomPrincipal; if (user != null) { try { var subId = Request.QueryString["subId"]; if (subId != null) { var subjectId = Convert.ToInt32(subId); using (var helper = new DbHelper.Classes()) { var subject = helper.GetSubject(subjectId); if (subject != null) { lblSubjectName.Text = subject.FullName; var cls = helper.ListAllClassesOfUserOfSubject(user.Id, subjectId); DataList1.DataSource = cls; DataList1.DataBind(); } else { Response.Redirect("~/"); } LoadSitemap(subject); } } } catch { Response.Redirect("~/"); } } }