Null Reference not set to an instance of an object
Posted on 2009-04-28
I am working on an asp.net site and the problem I am getting is an error saying the following:
'NULL REFERENCE NOT SET TO AN INSTANCE OF AN OBJECT'
and below is the line of code where I get this problem:
drLog.UserName = Membership.GetUser().UserName;
The problem is when I set the line of code above to be the following which is:
drLog.UserName = new Membership.GetUser().UserName;
I get an error that says the following:
System.Web.Security.Membership.GetUser(object, bool)' is a 'method' but is used like a 'type'
What can I do to get past this problem? Thanks!