3
Reply

Object reference not set to an instance of an object.

Ask a question
Cresen

Cresen

14y
3.9k
1
I badly need help for this C# code:

 MembershipUser CurrentUser = Membership.GetUser(User.Identity.Name);
 String varUserName = (String)CurrentUser.ProviderUserKey;

When I hit the F5 key, I got this error: "Object reference not set to an instance of an object." which is pointing to the 2nd line of the above code.

My goal is to assign to a variable the current user logged-in in the ASP.Net page..

Thanks soo... much in advance.



Answers (3)