.net - Facebook-C#-SDK wont stop "logging in" -


i trying build facebook webapp in vb.net using facebook c# sdk. sdk can used vb.net, know. trying app login on page load. can login, app not recognize logged in , continues loop through login again until stop it. here code.

protected sub page_load(byval sender object, byval e system.eventargs) handles me.load     dim faceauth new facebookclient     dim fbsession new facebooksession     if faceauth.accesstoken.length = 0         dim appid string = configurationmanager.appsettings("facebookappid")         dim extendedpermissions string() = {"publish_stream", "offline_access", "read_stream", "manage_pages"}         dim oauth = new facebookoauthclient() { _          .clientid = appid _         }         fbsession.expires = now.adddays(1)         dim parameters = new dictionary(of string, object)() { _          {"response_type", "code_and_token"}, _          {"display", "popup"}, _          {"redirect_uri", "http://newsocialspin.spintest.com/fbcsb.aspx"} _         }         if extendedpermissions isnot nothing andalso extendedpermissions.length > 0             dim scope = new stringbuilder()             scope.append(string.join(",", extendedpermissions))             parameters("scope") = scope.tostring()         end if         dim loginurl = oauth.getloginurl(parameters)         response.redirect(loginurl.tostring)     else         loggedin()     end if end sub 

i have tried countless different methods recognize logged in status no avail. if have ideas helpful please let me know, or if dev please correct obvious error. thanks.

you're creating new facebookclient on every page load, including redirected ones. thus, check on faceauth.accesstoken.length true. you'll need have cookie or session value survive redirects, , updated appropriately when log in via facebook.


Comments

Popular posts from this blog

apache - Add omitted ? to URLs -

redirect - bbPress Forum - rewrite to wwww.mysite prohibits login -

php - How can I stop spam on my custom forum/blog? -