What is wrong with this code? The error is Object reference not set to an instance of an object.
I have the below code in my class, then on the login page i need the GUID so i can perform a lookup in one of our custom tables. But then the error above pops up before the page even loads at the line Guid guid = (Guid)userInfo.ProviderUserKey;
public string usn
{
get
{
return Convert.ToString(HttpContext.Current.User.Identity.Name);
}
}
public int GUID
{
get
{
MembershipUser userInfo = Membership.GetUser(usn);
Guid guid = (Guid)userInfo.ProviderUserKey;
return Convert.ToInt32(guid);
}
}
...
Go to the complete details ...