HELP……Just moved to C# from vb and Im really lost with this.
var ldapmembershipUser = (LdapMembershipUser)System.Web.Security.Membership.GetUser("username");
var cnAttributeValues = ldapmembershipUser.Attributes["cn"];
Code bails at cnAttributeValues with Object reference not set to an instance of an object.
I dont know how to set it as a new ?? Object?
This is in reference to the nJupiter google controls.
Membership.GetUser(string)is documented to return:So that’s what’s happening here –
ldapmembershipUseris null because there’s no such user. You should check for that and act accordingly:Note that you could also have problems if
GetUserreturns a reference to an object which isn’t anLdapMembershipUser.