XML parser error

Aug 29, 2007 at 12:51 AM

I am using the code given in facebook developer toolkit. Always I am getting the xml parser error on my browser.
My code looks like this
protected void Page_Load(object sender, EventArgs e)
_fbService.ApplicationKey = "my app key is used here";
_fbService.Secret = "my secret key is used here";
_fbService.IsDesktopApplication = false;

string sessionKey = Session"Facebook_session_key" as String;
string userId = Session"Facebook_userId" as String;

// When the user uses the Facebook login page, the redirect back here will will have the auth_token in the query params
string authToken = Request.QueryString"auth_token";

if (!String.IsNullOrEmpty(sessionKey))
_fbService.SessionKey = sessionKey;
_fbService.UserId = userId;
else if (!String.IsNullOrEmpty(authToken))
Session"Facebook_session_key" = _fbService.SessionKey;
Session"Facebook_userId" = _fbService.UserId;
Session"Facebook_session_expires" = _fbService.SessionExpires;
Response.Redirect(@"http://www.Facebook.com/login.php?api_key=" + _fbService.ApplicationKey + @"&v=1.0");

if (!IsPostBack)
// Use the FacebookService Component to populate Friends
FriendList1.Friends = _fbService.GetFriends();
UserProfile1.User = _fbService.GetUserInfo();


The very first time I run my app it goes to response.redired (http://facebook etc.... and immediately it give me the xml parser error. The second time I run it it gives me the same error, but this time it returns a authtoken appended to my URL on the browser along with the error.
CAn anybody please tell me why is it behaving like this?
What I am doing for a workaround for this is, each time I take the authtoken and assign it to the auth-token string variable in the code and then it works fine the third time. Once I stop the app and start after sometime the same error cycle continues.
Can anybody please help?

Sep 12, 2007 at 3:59 AM
ARe you still having this issue?
Aug 24, 2009 at 6:00 PM

Hello rpowers119,


I am actually having this error.  is there a work around?  The error points to this method in LinqToXsdSource.cs in the facebook project.

public static friends_get_response Parse(string xml) {
            return XTypedServices.Parse<friends_get_response>(xml);

Aug 24, 2009 at 8:28 PM

I don't know if this is the same XML parsing error, but I'm getting this error when trying to fetch user info (on Ubuntu 64-bit machine running Mono

Value does not fall within the expected range.
System.ArgumentException: Value does not fall within the expected range.
  at System.Xml.Linq.XObject.Annotation (System.Type type) [0x00000]
  at System.Xml.Linq.XObject.Annotation[XTypedElementWrapperAnnotation] () [0x00000]
  at Microsoft.Xml.Schema.Linq.XTypedServices.GetAnnotation (System.Type t, System.Xml.Linq.XElement xe) [0x00000]
  at Microsoft.Xml.Schema.Linq.XTypedServices.GetAnnotation[users_getInfo_response] (System.Xml.Linq.XElement xe) [0x00000]
  at Microsoft.Xml.Schema.Linq.XTypedServices.ToXTypedElement[users_getInfo_response] (System.Xml.Linq.XElement xe) [0x00000]
  at Microsoft.Xml.Schema.Linq.XTypedServices.Parse[users_getInfo_response] (System.String xml) [0x00000]
  at facebook.Schema.users_getInfo_response.Parse (System.String xml) [0x00000]
  at facebook.users.getInfo (System.String uids) [0x00000]
  at facebook.users.getInfo (Int64 uid) [0x00000]