protected void btnPageSelect_Click(object sender, EventArgs e) { try { DataTable dtNewPages = new DataTable(); DataColumn[] dcPage = new DataColumn[3]; dcPage[0] = new DataColumn("pid", System.Type.GetType("System.String")); dtNewPages.Columns.Add(dcPage[0]); dcPage[1] = new DataColumn("pname", System.Type.GetType("System.String")); dtNewPages.Columns.Add(dcPage[1]); dcPage[2] = new DataColumn("pacctoken", System.Type.GetType("System.String")); dtNewPages.Columns.Add(dcPage[2]); dtNewPages = (DataTable)(Cache["PageDetails"]); DataView dv; dv = new DataView((DataTable)(Cache["PageDetails"])); dv.RowFilter = "pname= '" + ddlPageSelect.SelectedItem.ToString() + "'"; //fetch the custom tab name FacebookBizProcess fbBiz = new FacebookBizProcess(); string custTabName = fbBiz.GetCustomTabName(SessionData.Config.AppID); StringBuilder _sbPostToWallPostData = new StringBuilder(); _sbPostToWallPostData.Append("custom_name=" + custTabName); string pagetab = "https://graph.facebook.com/" + dv[0]["pid"].ToString().Replace("\"", "") + "/tabs?method=POST&app_id=" + SessionData.Config.AppID + "&access_token=" + ddlPageSelect.SelectedValue.ToString().Replace("\"", ""); FaceBook fabo = new FaceBook(); fabo.CallWebRequest("POST", pagetab, _sbPostToWallPostData.ToString()); //generate URL for page tab //string pageName = CallPageTabs(dv[0]["pid"].ToString()); StringBuilder oSBAppPath = new StringBuilder(); oSBAppPath.Append("https://www.facebook.com/pages/"); oSBAppPath.Append(ddlPageSelect.SelectedItem.ToString() + "/"); oSBAppPath.Append(dv[0]["pid"].ToString() + "/"); oSBAppPath.Append("?sk=app_" + SessionData.Config.AppID); lblResult.Text = "Campaign uploaded. Click"; if (SessionData.UserAction.TaskComplete.Equals("M")) { lblInformation.Text = "Your Microsite has been processed ! Please find the details in your Email inbox."; } else if (SessionData.UserAction.TaskComplete.Equals("Y")) { lblInformation.Text = "Your Microsite has been processed ! Please find the details in your Email inbox."; } else { lblInformation.Text = string.Empty; } fbBiz.UpdateAppPagePath(oSBAppPath.ToString(), SessionData.Config.AppID, dv[0]["pid"].ToString()); linkToCamp.HRef = oSBAppPath.ToString(); tblPageSelect.Visible = false; tblResult.Visible = true; if (bEnableTwitter == true) { tblTweet.Visible = true; } //Response.Redirect("CanvasArea.aspx?CDID=" + SessionData.Customer.CustomerID+"&pageSelected=T&TID=0",true); } catch (Exception ex) { CommonUtility commUtil = new CommonUtility(); commUtil.SendErrorMail(ex.Message, ex.StackTrace, System.Reflection.MethodBase.GetCurrentMethod().Name.ToString(), System.Reflection.MethodBase.GetCurrentMethod().DeclaringType.ToString(), SessionData.Customer.CustomerID); } }