ОБНОВЛЕНИЕ С тех пор я смог заставить всплывающее окно работать.Я удалил / закомментировал ненужный код, который использовал ниже.По какой-то странной причине мне пришлось переключиться на Aspx от моего Ashx.Просто убедитесь, что все переменные, которые вы просматриваете в своей базе данных, существуют:)
У меня возникли проблемы с реализацией кредитов Facebook в мое приложение Facebook.Я использую Facebook C # SDK , и я уверен, что мой javascript кошерный.Я нашел этот блог полезным, но я получаю ошибку AppInvalidDecodedResponse от facebook в моем обратном вызове javascript.Я просто сначала пытаюсь отобразить всплывающее окно покупки.Вот мой обратный вызов 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();
}