protected void Page_Load(object sender, EventArgs e) { // if this is a callback that is providing the twitter access token, then update with the token. if (!String.IsNullOrEmpty(Request["oauth_token"]) && Page.User.Identity.IsAuthenticated) { if (String.IsNullOrEmpty(Request["oauth_verifier"])) { throw new MyFlightbookException("oauth token passed but no oauth_verifier along with it."); } oAuthTwitter oAuth = new oAuthTwitter(); oAuth.AccessTokenGet(Request["oauth_token"], Request["oauth_verifier"]); mfbTwitter.SetUserTwitterToken(Page.User.Identity.Name, oAuth); } if (util.GetStringParam(Request, "oauth_token").Length > 0) { LogbookEntry le = mfbTwitter.PendingFlightToPost; if (le != null) { mfbTwitter.PostFlight(le); mfbTwitter.PendingFlightToPost = null; // clear it } } Response.Redirect(SocialNetworkAuthorization.PopRedirect(Master.IsMobileSession() ? SocialNetworkAuthorization.DefaultRedirPageMini : SocialNetworkAuthorization.DefaultRedirPage)); }
protected void Page_Load(object sender, EventArgs e) { string szCode = util.GetStringParam(Request, "code"); if (!String.IsNullOrEmpty(szCode)) { Profile pf = MyFlightbook.Profile.GetUser(Page.User.Identity.Name); pf.GooglePlusAccessToken = szCode; pf.FCommit(); } Response.Redirect(SocialNetworkAuthorization.PopRedirect(Master.IsMobileSession() ? SocialNetworkAuthorization.DefaultRedirPageMini : SocialNetworkAuthorization.DefaultRedirPage)); }
protected void FlightUpdated(object sender, EventArgs e) { // if we had been editing a flight do a redirect so we have a clean URL // OR if there are pending redirects, do them. // Otherwise, just clean the page. if (Request[szParamIDFlight] != null || SocialNetworkAuthorization.RedirectList.Count > 0) { Response.Redirect(SocialNetworkAuthorization.PopRedirect(Master.IsMobileSession() ? SocialNetworkAuthorization.DefaultRedirPageMini : "~/Member/LogbookNew.aspx")); } else { Response.Redirect("~/Member/Logbook.aspx", true); } }
protected void mfbEditFlight1_FlightUpdated(object sender, LogbookEventArgs e) { if (e == null) { throw new ArgumentNullException("e"); } // if we had been editing a flight do a redirect so we have a clean URL // OR if there are pending redirects, do them. // Otherwise, just clean the page. if (Request[szParamIDFlight] != null || SocialNetworkAuthorization.RedirectList.Count > 0) { Response.Redirect(SocialNetworkAuthorization.PopRedirect(Master.IsMobileSession() ? SocialNetworkAuthorization.DefaultRedirPageMini : SocialNetworkAuthorization.DefaultRedirPage)); } else if (e.IDNextFlight != LogbookEntry.idFlightNone) { Response.Redirect(String.Format(CultureInfo.InvariantCulture, "~/Member/LogbookNew.aspx/{0}{1}", e.IDNextFlight, Request.Url.Query), true); } else { Response.Redirect(String.Format(CultureInfo.InvariantCulture, "~/Member/LogbookNew.aspx{0}", Request.Url.Query), true); } }
private void HandleOAuthRedirect() { if (!String.IsNullOrEmpty(Request.Params[szParamDropboxAuth])) // redirect from Dropbox oAuth request. { m_pf.DropboxAccessToken = new MFBDropbox().ConvertToken(Request).AccessToken; m_pf.FCommit(); Response.Redirect(String.Format(CultureInfo.InvariantCulture, "{0}?pane=backup", Request.Path)); } if (!String.IsNullOrEmpty(Request.Params[szParamGDriveAuth])) // redirect from GDrive oAuth request. { m_pf.GoogleDriveAccessToken = new GoogleDrive().ConvertToken(Request); m_pf.FCommit(); Response.Redirect(String.Format(CultureInfo.InvariantCulture, "{0}?pane=backup", Request.Path)); } if (!String.IsNullOrEmpty(Request.Params[szParam1DriveAuth])) // redirect from OneDrive oAuth request. { m_pf.OneDriveAccessToken = (DotNetOpenAuth.OAuth2.AuthorizationState)Session[OneDrive.TokenSessionKey]; m_pf.FCommit(); Response.Redirect(String.Format(CultureInfo.InvariantCulture, "{0}?pane=backup", Request.Path)); } if (!String.IsNullOrEmpty(Request.Params[MFBFacebook.OAuthParam])) // redirect from FB oAuth request { try { m_pf.FacebookAccessToken = MFBFacebook.ConvertToken(Request); m_pf.FCommit(); mfbFacebook1.PostPendingFlight(); } catch (MyFlightbookException) { } Response.Redirect(SocialNetworkAuthorization.PopRedirect(String.Format(CultureInfo.InvariantCulture, "{0}?pane=social", Request.Path))); } }
protected void EnteredFlight(object sender, EventArgs e) { Response.Redirect(SocialNetworkAuthorization.PopRedirect(SocialNetworkAuthorization.DefaultRedirPage)); }