By using this site, you agree to our updated Privacy Policy and our Terms of Use. Manage your Cookies Settings.
458,125 Members | 1,529 Online
Bytes IT Community
+ Ask a Question
Need help? Post your question and get tips & solutions from a community of 458,125 IT Pros & Developers. It's quick & easy.

Profile Problems

P: n/a
Dear Friends,

I am having problems with the following:

I have added a Login control to a web page. In the Login control's
Authenticate event, I am performing additional validation against our
database to make sure a user exists. If all goes well, I set the
e.Authenticated property equal to True. At the same time, (while still in
the Authenticate event), I retrieve a row from our database which contains
user specific information (Name, Address, etc....). Here is where the
problem lies:

In my Web.Config file, I have defined a profile which basically looks
like the information row retrieved. For each profile property, I add the
allowAnonymous=false attribute as I only want to allow authenticated users
onto my site with their specific profile loaded from our database. When I
try to assign the properties from my database row to the profile
(Profile.FirstName = CurrentUserNameField), I receive an error stating that I
am still anonymous and that I cannot assign properties to profile that does
not allow for anonymous users. I can use the above code in any other page
and it will work correctly, but from within the Login control's Authenticate,
and LoggedIn events, I seem to be still anonymous although I am not. Its
almost like I have to leave those events for Profile property assignment.
Can anyone please help me?

Regards,

Giovanni
May 13 '06 #1
Share this Question
Share on Google+
1 Reply


P: n/a
That's because for the request where the user is submitting their username/passwrd
they're not yet authenticated, thus the profile isn't loaded for that specific
user. The Profile loading code doesn't know if the username/password submitted
are wrong, so it really can't automatically load the profile until the next
request.

Now, you can manually load and save the profile if you'd like from the Authenticate
event:

ProfileCommon theProfile = Profile.GetProfile("TheUserName");
theProfile.SomeValue = 5;
theProfile.Save();

-Brock
http://staff.develop.com/ballen

Dear Friends,

I am having problems with the following:

I have added a Login control to a web page. In the Login
control's Authenticate event, I am performing additional validation
against our database to make sure a user exists. If all goes well, I
set the e.Authenticated property equal to True. At the same time,
(while still in the Authenticate event), I retrieve a row from our
database which contains user specific information (Name, Address,
etc....). Here is where the problem lies:

In my Web.Config file, I have defined a profile which basically
looks like the information row retrieved. For each profile property,
I add the allowAnonymous=false attribute as I only want to allow
authenticated users onto my site with their specific profile loaded
from our database. When I try to assign the properties from my
database row to the profile (Profile.FirstName =
CurrentUserNameField), I receive an error stating that I am still
anonymous and that I cannot assign properties to profile that does not
allow for anonymous users. I can use the above code in any other page
and it will work correctly, but from within the Login control's
Authenticate, and LoggedIn events, I seem to be still anonymous
although I am not. Its almost like I have to leave those events for
Profile property assignment. Can anyone please help me?

Regards,

Giovanni

May 14 '06 #2

This discussion thread is closed

Replies have been disabled for this discussion.