示例#1
0
        protected void lnkDeleteProfile_Click(object sender, EventArgs e)
        {
            string username = Session["Username"].ToString();

            UserService.UserService proxy = new UserService.UserService();
            bool delete = proxy.DeleteUser(username);

            if (!delete)
            {
                ScriptManager.RegisterClientScriptBlock(this, this.GetType(), "alertMessage", "alert('Profile delete failed, please contact a developer.')", true);
            }
            else
            {
                if (Request.Cookies["Username"] != null)
                {
                    Response.Cookies["Username"].Expires = DateTime.Now.AddDays(-1);
                }
                Session.Abandon();
                Response.Redirect("Login.aspx");
            }
        }