Re: GetUser.ProviderUserKey gives me System.NullReferenceException
- From: "Eliyahu Goldin" <REMOVEALLCAPITALSeEgGoldDinN@xxxxxxxxxxxx>
- Date: Sun, 6 Jul 2008 11:45:33 +0300
The authentication principal won't get set until the next request to the
web-server. That's why GetUser returns. But you can use the "UserName"
property of the Login control
within the LoggedIn event to identify the user. With this name, you can use
Membership.GetUser(userName).
--
Eliyahu Goldin,
Software Developer
Microsoft MVP [ASP.NET]
http://msmvps.com/blogs/egoldin
http://usableasp.net
"Cirene" <cirene@xxxxxxxxxxx> wrote in message
news:%23kiVgEk3IHA.4800@xxxxxxxxxxxxxxxxxxxxxxx
Using asp.net membership. My login.aspx page goes to the
loginredirect.aspx page after the user logs in.
For some reason "Membership.GetUser.ProviderUserKey.ToString" gives me
this error:
System.NullReferenceException: Object reference not set to an instance of
an object. at loginredirect.Page_Load(Object sender, EventArgs e)
Any reason why? I should be logged in fine.
Is there another way in which I should get the current users UserId?
.
- References:
- Prev by Date: Re: Question about the asp.net 2.0 web configuration tool outside of development
- Next by Date: Disapearing Changes
- Previous by thread: Re: GetUser.ProviderUserKey gives me System.NullReferenceException
- Next by thread: Re: GetUser.ProviderUserKey gives me System.NullReferenceException
- Index(es):
Relevant Pages
|
Loading