protected void Page_Load(object sender, EventArgs e) { try { //check if the user id is in the cookie HttpCookie userCookies = Request.Cookies["userInfo"]; //Get the role of the user from the cookie String type = ""; if (Session["type"] != null) { type = Session["type"].ToString(); } //Redirect to login page if the id is absent if (userCookies == null || userCookies["id"] == "" || userCookies["type"] == "member" || userCookies["type"] == "admin" || userCookies["type"] == "") { Response.Redirect("~/StaffLogin.aspx"); } //Redirect to login page if the role is incorrect else if (type.Equals("member") || type.Equals("admin")) { Response.Redirect("~/StaffLogin.aspx"); } else { if (!Page.IsPostBack) { if (!(userCookies == null) && !(userCookies["id"] == "")) { idLbl.Text = userCookies["id"]; } //Create an object of service reference Assignment5ServiceRefs.Service1Client client = new Assignment5ServiceRefs.Service1Client(); //Transform the user and the book xml files UsersInfoLbl.Text = client.transformationMembers(); BooksInfoLbl.Text = client.transformationBooks(); } } } catch {} }