I encountered an error
Unable to bind runtime to null reference
Description: An unhandled exception occurred during the execution of the current web request. Check the stack trace for more information about the error and where it appeared in the code.
Exception Details: Microsoft.CSharp.RuntimeBinder.RuntimeBinderException: Unable to bind while executing a null reference
Source Error:
Line 27: lblBirthday.Text = (myInfo.birthday == null? String.Empty: DateTime.Parse (myInfo.birthday) .ToString ("dd-MMM-yy")); Line 28: lblHometown.Text = (myInfo.hometown.name == null? String.Empty: myInfo.hometown.name); Line 29: lblLocation.Text = (myInfo.location.name == null? String.Empty: myInfo.location.name); Line 30: pnlHello.Visible = true; Line 31:}
Here is my code:
var fb = new FacebookWebClient(); dynamic myInfo = fb.Get("me"); lblName.Text = myInfo.name; imgProfile.ImageUrl = "https://graph.facebook.com/" + myInfo.id + "/picture"; lblBirthday.Text = (myInfo.birthday == null ? string.Empty : DateTime.Parse(myInfo.birthday).ToString("dd-MMM-yy")); lblHometown.Text = (myInfo.hometown.name == null ? string.Empty : myInfo.hometown.name); lblLocation.Text = (myInfo.location.name == null ? string.Empty : myInfo.location.name); pnlHello.Visible = true;
c # facebook facebook-c # -sdk
Nikhil Gupta
source share