UPDATE これまでポップアップが動作するようになった。私は以下で使用していた不要なコードを削除/コメントアウトしました。奇妙な理由のために、私はashxからaspxに切り替える必要がありました。あなたのデータベースで検索する変数がすべて存在することを確認してください:)C#SDKのFacebookクレジット
私はFacebookブッククレジットにいくつかの問題を抱えています。私はFacebook C# SDKを使用しています。私はjavascriptが正当なものだと確信しています。私はthisブログを参考にしていますが、私のjavascriptコールバックでFacebookからAppInvalidDecodedResponseエラーが戻ってきています。私は最初、表示するために '購入'ポップアップを取得しようとしています。ここでは、アプリの設定で指定された私のASHXコールバックは、次のとおりです。
public void Page_Load(object sender, EventArgs e)
{
string order_id = Request.Form["order_id"];
string method = Request.Form["method"];
string order_info = Request.Form["order_info"];
FacebookBuyItem theItem = new FacebookBuyItem();
theItem.title = "item not found";
theItem.price = "1";
theItem.image_url = Utilities.GlobalSettings["WebDomain"];
theItem.product_url = Utilities.GlobalSettings["WebDomain"];
theItem.description = "item not found";
if (method == "payments_get_items")
{
//order_info = (string)data["order_info"];
//order_info = order_info.Substring(1, (order_info.Length - 2));
using (SqlCommand cmd = new SqlCommand())
{
cmd.Connection = new SqlConnection(Utilities.PluginSettings["SQL Database"]["ConnectionString"]);
cmd.Connection.Open();
cmd.CommandType = System.Data.CommandType.StoredProcedure;
cmd.CommandText = "dbo.GetItem";
cmd.Parameters.Add("@ItemID", System.Data.SqlDbType.Int).Value = int.Parse(order_info);
SqlDataReader dr = cmd.ExecuteReader();
if (dr.Read())
{
theItem.title = dr["ItemName"].ToString();
theItem.price = dr["FacebookCreditCost"].ToString();
theItem.image_url = dr["ThumbPath"].ToString();
theItem.product_url = dr["ThumbPath"].ToString();
theItem.description = dr["Description"].ToString();
}
dr.Close();
cmd.Connection.Close();
}
}
//Utilities.Dump(order_info, order_id, method);
var res = new Dictionary<string, object>();
res["method"] = method;
//res["order_id"] = order_id;
res["content"] = new object[] { theItem };
JavaScriptSerializer jss = new JavaScriptSerializer();
string ob = jss.Serialize(res);
//ob = ob.Replace("#$", @"\/");
Response.ContentType = "application/json";
Response.Write(ob);
Response.End();
}
助けてくれてありがとうございますが、まだ問題があります。主に、実際に呼び出されているかどうかを知ることは難しいです。私のコールバックashxでは、私はコントロールの流れに関係なく、データベースにエントリを記録しています(最初のことです)。手動で呼び出すと、レコードがデータベースにダンプされるのがわかりますが、私たちのアプリケーションから呼び出されると無効なデコードの応答が返されますが、決して呼び出されなかったかのようにデータベースに格納されるものはありません。何かご意見は?前もって感謝します。 –
私はアプリケーションコールバックの下でFBクレジットapiを見直し、例の後で私のリターンを鏡映しようとしました: '' content ":[{" title ":" [Test Mode] Unicorn "、" description ":" [Test Mode ]、 "価格":2、 "image_url": "http:\/\/www.facebook.com \/images \/gifts \ /21.png"、 "product_url": "http "私は、" order_id "部分を省略するために 'res'オブジェクトを変更しました。私は 'order_id'部分を省略するように 'res'オブジェクトを変更しました。 ob.replaceの混乱を取り除いた。そこからサンプルポップアップを取得してから、データベースルックアップコードのエラーをデバッグすることができました。おかげで –
私はさらに助けることができることを知って聞いてよかったです。 – DSchultz