コード例 #1
0
    protected void btUnsubscribeContact_Click(object sender, EventArgs e)
    {
        ///Contact ID
        int contactId = Mailee.Util.parseInt(Request.QueryString["id"]);

        //Unsubscribe
        try
        {
            //Fill Contact
            Mailee.Contact contact = new Mailee.Contact(contactId);

            //Unsubscribe contact
            contact.Unsubscribe();

            //Redirect
            Response.Redirect("View.aspx");
        }
        catch (Mailee.RestExcepction ex)
        {
            //Show http status
            Response.Write(string.Format("statusCode =  {0} <br /> statusDescription = {1}", ex.StatusCode, ex.StatusDesciption));

            //Show error messages
            foreach (string error in ex.ErrorMessages)
                Response.Write("<br />" + error);
        }
        catch (Exception ex)
        {
            Response.Write(ex.Message);
        }
    }