asp.net - Could "Context.User" be a null? -
In my masterpages code, I try to get authenticated (if it is) behind the UserID:
Public Gid Current UserID {Receive {GUID userID = New Good (); If (Theme user.Defination.ass not authenticated) {Membership user user = membership Getuser (reference user.indent.name); UserID = (good) user. Provider user; } User ID return; }}
Once the error "object reference is not set to an instance of an object" appears. I suspect that the problem is in the case. Could this be the reason for the user = tap?
The user may have been removed by the DB, while it was certified, therefore membership GETUser
returned null
and user.ProviderUserKey
removed NullReferenceException
.
Comments
Post a Comment