views:

426

answers:

0

Hello,

I am trying to use facebook connection with ie7 in asp.net.

when i click on the facebook login button -- facebook gives me a small box to enter my email and password. After login, In most of the websites the small box (login box) will close and the main page login button will change to facebook logout button.

but in my code: the main page where i click the facebook login button is not getting refreshed and the small widow where i entered user name and password is not being closed.

-- Please let me know if anyone had this issue before.

    <!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd"&gt;
<html xmlns="http://www.w3.org/1999/xhtml" xmlns:fb="http://www.facebook.com/2008/fbml"&gt;
<head runat="server">
    <title>Fb Connect Page</title>
</head>
<body>
    <script src="http://static.ak.connect.facebook.com/js/api_lib/v0.4/FeatureLoader.js.php" type="text/javascript"></script>
    <form id="form1" runat="server">
    <div>
    <fb:login-button length="short" onlogin="window.location.reload();" autologoutlink="true" size="large"></fb:login-button>
    <fb:prompt-permission perms="status_update">Please click here to grant permisison to app to use facebook</fb:prompt-permission>
        <asp:TextBox ID="TextBox1" runat="server" Visible="false"></asp:TextBox>
        <asp:Button ID="Button1" runat="server" Text="Post to Wall" visible ="false"/>
        </div>
    </form>
<script type="text/javascript">
    FB_RequireFeatures(["XFBML"], function(){
                FB.Facebook.init("a224gsd09k87h6ffd345dsw09jg7345", "xd_receiver.htm")
                });
</script>
</body>
</html>

Protected Sub Page_Load(ByVal sender As Object, ByVal e As System.EventArgs) Handles Me.Load

If fbconnect.isAuthenticated Then

    TextBox1.Visible = True
    Button1.Visible = True

    Dim myAPI As New API
    myAPI.ApplicationKey = fbconnect.APIkey
    myAPI.Secret = fbconnect.SecretKey
    myAPI.SessionKey = fbconnect.SessionKey
    myAPI.uid = fbconnect.UIDKey

    Dim myuser As String = myAPI.users.getInfo.name
    Response.Write(myuser)

    Dim myusers As New facebook.users(myAPI)

    If myusers.hasAppPermission(Types.Enums.Extended_Permissions.status_update) Then
        myusers.setStatus(TextBox1.Text)
    End If
    Response.Write("Auth")
Else
    Response.Write("Not Authenticated")
    TextBox1.Visible = False
    Button1.Visible = False
End If

End Sub