How to get the Page Id in my Facebook Application page

后端 未结 3 2004
难免孤独
难免孤独 2021-02-11 01:58

I have my application is hosted in FaceBook as a tab and I want to get the page ID when my application is being added to be stored in my logic. How can I get the page ID, I kno

3条回答
  •  有刺的猬
    2021-02-11 02:46

    Here's the same solution as Andy Sinclairs's in VB that worked for me:

    Dim pageId as Int64 = 0
    Dim signed_request As String = Request.Form("signed_request")
    Dim req = FacebookSignedRequest.Parse(AppSettings("FacebookSecret"), signed_request)
    Dim data As IDictionary(Of String, Object) = req.Data
    If data.ContainsKey("page") Then
        Dim RawPageData As Facebook.JsonObject = data("page")
        If RawPageData.ContainsKey("id") Then
          pageId = RawPageData("id")
        End If
    End If
    

提交回复
热议问题