Can you tell me what is wrong with the code I attach? When I run it I get this: "Object reference not set to an instance of an object."
If I understand correctly, the membership object has not yet been created. But when is it created? I need to execute a piece of code every time an user logs in (at the beginning of each session). And I need the UserId for that code.
Is there another event I can use to execute my code after the user logs in but before the user sees any page in the application?
Thanks in advance.
Protected Sub Login_LoggedIn(ByVal sender As Object, ByVal e As System.EventArgs) Handles Login.LoggedIn
Dim UserId As Guid = Membership.GetUser.ProviderUserKey