protected void btnSave_Click(object sender, EventArgs e) { if (state == "add") { HttpCookie AddMsgCookie = new HttpCookie("status"); AddMsgCookie.Value = "add"; AddMsgCookie.Expires = DateTime.Now.AddSeconds(6); Response.Cookies.Add(AddMsgCookie); BL.AddNewCategory(txtCategoryName.Text, txtCategoryDesc.InnerText); Response.Redirect("Categories.aspx"); } else { HttpCookie UpdateMsgCookie = new HttpCookie("status"); UpdateMsgCookie.Value = "update"; UpdateMsgCookie.Expires = DateTime.Now.AddSeconds(6); Response.Cookies.Add(UpdateMsgCookie); BL.UpdateCategory(Convert.ToInt32(Request.QueryString["id"]), txtCategoryName.Text, txtCategoryDesc.InnerText); state = "add"; Response.Redirect("Categories.aspx"); } }