Page caught in a loop when CanvasAuthorizer.Permissions has more than one permission
I have a web project (not mvc) and I am trying to learn about facebook integration (I am a facebook dev noob). In my page I have some simple html and an asp.net button. I added a hidden field for signed_request (for the buttons postback) and that seems ok too. The problem comes in when I try to add multiple permissions in my page_load. If I only check for user_about_me permissions the page seems to work correctly. If I add the publish_stream permission, then the page constantly loops and just loads over and over (getting redirected each time). Here is my page_load code when it loops, to make it not loop I just remove the comma and second permission. Weird thing is EITHER permission works on its own:
protected void Page_Load(object sender, EventArgs e)
{
var auth = new CanvasAuthorizer();
auth.Permissions = new[] { "user_about_me,publish_stream" };
if (auth.Authorize())
{
var fb = new FacebookWebClient();
dynamic me = fb.Get("me");
lblAuth.Tex开发者_如何转开发t = string.Format("User {0} has given permission for this app.", me.name);
}
else
{
lblAuth.Text = "You have not given permission to this application";
}
}
My aspx looks like this:
<asp:Label ID="lblAuth" runat="server" Text=""></asp:Label>
<% if(!string.IsNullOrEmpty(Request.Params["signed_request"])) { %>
<input type="hidden" name="signed_request" value="<%= Request.Params["signed_request"] %>" />
<% } %>
<asp:Button ID="btnPlaceOrder" runat="server" Text="Place Order"
onclick="btnPlaceOrder_Click" />
<asp:Label ID="lblOrderPlaced" runat="server" Text=""></asp:Label>
Thanks for any help!! -Jeff
change
auth.Permissions = new[] { "user_about_me,publish_stream" };
to
auth.Permissions = new[] { "user_about_me", "publish_stream" };
精彩评论