c# - Controller action never calls -
after redirect facebook getting code token , when facebook redirect me, app stop responding, action, should called never fires up. problem?
my routes
routes.maproute( "enter facebook return", "enter/facebook/return", new { controller = "users", action = "facebookreturn" } //callback action, not called -> problem ); routes.maproute( "enter facebook", "enter/facebook", new { controller = "users", action = "facebook" } );
and controller
public actionresult facebook() { oauth2 facebook = new oauth2( configurationmanager.appsettings["oauth_facebook_id"].tostring(), configurationmanager.appsettings["oauth_facebook_secret"].tostring(), configurationmanager.appsettings["oauth_facebook_authorize"].tostring(), configurationmanager.appsettings["oauth_facebook_access"].tostring(), configurationmanager.appsettings["oauth_facebook_return"].tostring() ); session["enter_facebook"] = facebook; // save data session dictionary<string, string> p = new dictionary<string, string> { { "scope", "email" } }; string redirecturl = facebook.getauthcode(p); //redirect url //redirect url looks https://www.facebook.com/dialog/oauth?client_id=111111111&response_type=code&redirect_uri=http%3a%2f%localhost.loc%2fenter%2ffacebook%2freturn&scope=email return redirect(redirecturl); } public actionresult facebookreturn(string code) { if (!string.isnullorempty(code)) { //after returning oauth2 facebook = (oauth2)session["enter_facebook"]; facebook.code = code; //getting code dictionary<string, string> p = new dictionary<string, string> { { "client_secret", configurationmanager.appsettings["oauth_facebook_secret"].tostring() } }; //additional params oauth2token token = facebook.getaccesstoken(p, oauth2.accesstokentype.dictionary); //getting marker access string access_token = token.dictionary_token["access_token"]; if (!string.isnullorempty(access_token)) { string user_data = oauth2userdata.getfacebookuserdata(access_token); //getting data user string = ""; } } return view("enter"); }
my livehhttpheader
get https://www.facebook.com/dialog/oauth?client_id=111111111&response_type=code&redirect_uri=http%3a%2f%localhost.loc%2fenter%2ffacebook%2freturn&scope=email host: www.facebook.com user-agent: mozilla/5.0 (windows nt 6.1; rv:23.0) gecko/20100101 firefox/23.0 accept: text/html,application/xhtml+xml,application/xml;q=0.9,*/*;q=0.8 accept-language: ru-ru,ru;q=0.8,en-us;q=0.5,en;q=0.3 accept-encoding: gzip, deflate dnt: 1 referer: http://localhost.loc/enter connection: keep-alive
so @ end of see when click on "login facebook":
2.http://localhost.loc/enter/facebook/return?code=2222222222
3.my app stopped here, facebookreturn(string code) never called, can't address in p.2 (sign in firefox loading , never ends), if call p.2 without redirect fine
so question is: why after redirecting facebook site action never calles , seems in application pool problems
Comments
Post a Comment