Hello Dear, I m Using MailChimpAspNet.dll version 1.0.0.0 and CookComputing.XmlRpcV2.dll.
Now adding both this dll my code in
ASP.NET 4.0 application. It works fine. but the prob is when
I hv a class named IMailChimp.cs file with the code below:
using System;
using System.Collections.Generic;
using System.Linq;
using System.Web;
using CookComputing.XmlRpc;
using MailChimpAspNet.MailChimpSubscribe;
namespace MailChimpAspNet.MailChimpSubscribe
{
[XmlRpcUrl("
http://us1.api.mailchimp.com/1.3/")]//analoga me to apikey (
http://apidocs.mailchimp.com/rtfm )
public interface IMailChimp
{
[XmlRpcMethod("listSubscribe")]
bool listSubscribe(string apikey, string id, string email_address,string [] merge_vars,string email_type="html",
bool double_optin=false,bool replace_interests=true,bool send_welcome=false);
[XmlRpcMethod("listUnsubscribe")]
bool listUnsubscribe(string apikey, string id, string email_address, bool delete_menber=false,
bool send_goodbye=true, bool send_notify=true);
}
}
i my code behind page.. at the button click event:
protected void btnsubscribe_Click(object sender, EventArgs e)
{
IMailChimp mailchimp = (IMailChimp)XmlRpcProxyGen.Create(typeof(IMailChimp));
try
{
string[] merge_vars = new string[1];
merge_vars[0] = txtsubscribeEmail.Value;
bool ok = mailchimp.listSubscribe("xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx-us1", "xxxxxxxxxx", txtsubscribeEmail.Value, merge_vars, "html", false, true, true);
if (ok)
{
initSub();
lblresult.Visible = true;
Utility.clsUtility.setFansyMessage(lblresult, "Success", "Your Email ID has been Successfully Subscribed.");
txtsubscribeEmail.Value = "";
txtsubscribeName.Value = "";
}
else
{
lblresult.Visible = true;
Utility.clsUtility.setFansyMessage(lblresult, "Fail", "Email Error!");
}
}
//Response.Redirect("MailChimpSub.aspx?EmailID=" + txtsubscribeEmail.Value.ToString());
catch (Exception ex)
{
lblresult.Text = ex.Message;
}
}
Now, On Compling and running and debbugging..
I get the Exception:
Server returned a fault exception: [104] Invalid Mailchimp API Key: xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx-us1 . You are accessing the wrong datacenter - your client library may not properly support our datacenter mapping scheme.
what the hell is this.!! now wait wait wait...
I hv another mail chimp acc. in that using its api key. it works perfect in this above demo code.. now pls Can anyone let me know why such stuff happen.
Is this due to datacenter.. if you say yes then. i wud let u knw that without giving datacenter. and using my another mailchimp acc. api key works perfect(-us6).. but using my original acc.(-us1). and i only want to use my -us1 acc. apikey.. but which is giving me the above mentioned exception..
Let me know ASAP the solution that y this exception coming from m waiting. Thnx in advnce dear..