Profile Problems



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?





Brock Allen

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

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

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

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question