5

Closed

Changeset 12819 - Broken Redirect?

description

Trying the recent check in.
 
Noticed that redirect has an error if a user is not logged in.
 
Error:
 
Object reference not set to an instance of an object.
 
at Facebook.Web.FacebookApplication.Redirect(String url, Boolean detectRelativeUrl)
at Facebook.Web.FacebookApplication.OnPagePreLoad(Object sender, EventArgs e)
at System.Web.UI.Page.OnPreLoad(EventArgs e)
at System.Web.UI.Page.ProcessRequestMain(Boolean includeStagesBeforeAsyncPoint, Boolean includeStagesAfterAsyncPoint)
 
 
In VS.NET debug, it breaks around here:
 
private void Redirect(string url, bool detectRelativeUrl) {
        Debug.Assert(String.IsNullOrEmpty(url) == false);
 
**** breaks here **** >>> if (_session.SessionType == FacebookSessionType.PresencePage) {
            int queryIndex = url.IndexOf('?');
            url += (queryIndex >= 0) ? "&" : "?";
            url += "fb_page_id=" + UserID;
        }
Closed Jan 14, 2008 at 4:49 AM by NikhilK
Fixed in 0.3.0.0

comments

jgr4 wrote Dec 5, 2007 at 3:44 PM

The problem is that _session is null. Check out the code at the end of FacebookApplication.OnPagePreload().
           if (redirectUrl == null) {
                _session = session;
                _service = new FacebookService(_session);
                OnSessionCreated(EventArgs.Empty);
            }
            else {
                if ((_mode != FacebookApplicationMode.IFrame) || InIFramePage ||
                    (_enableExternalBrowsing == false)) {
                    Redirect(redirectUrl, /* detectRelativeUrl */ false);
                }
            }
Note that _session is not being assigned to in the else block - but is then being accessed in the redirect.

wrote Dec 5, 2007 at 3:54 PM

wrote Dec 6, 2007 at 10:25 PM

wrote Dec 11, 2007 at 8:55 PM

NikhilK wrote Dec 21, 2007 at 6:37 AM

Checked in change # 13379. Will include the fix into the next release.

wrote Dec 21, 2007 at 6:37 AM

wrote Jan 14, 2008 at 4:40 AM

wrote Jan 14, 2008 at 4:48 AM

wrote Jan 14, 2008 at 4:49 AM

jytu wrote Jul 10, 2009 at 10:25 AM

I've go the same problem today. I use 3.0.0 facebooknet

wrote Feb 21, 2013 at 10:58 PM

wrote May 16, 2013 at 10:42 AM