Why change my new profile value to default value once authenticated

calvin

Regular
Joined
Nov 6, 2003
Messages
71
Hi,

I was create a login page to authenticate user. When user click on the "Login" button, it will post value to couple of profile.

Protected Sub LoginButton_Click(ByVal sender As Object, ByVal e As EventArgs)

Profile.SchoolID = "School001"
Profile.UserID = "A0001"
Profile.Role = "admin"
Profile.Save()
End Sub

I did set the DestinationPageUrl to my first page. I was using the master page with Navigation Menu. All of this if working, If a user is "admin" role and authenticated, then user will go to my first page(DestinationPageUrl) and get "admin" Menu.

My problem is when user click the Login button, the database have store this new profile value. But when it come to the DestinationPageUrl, it change my new profile value to my default value. The default value is set in web.config page. So, the "admin" user get the default "menu" since his role has change to normal user.

Web.config
<anonymousIdentification enabled="true"/>
<profile>
<properties>
<add name="SchoolID" defaultValue="EDU01" allowAnonymous="true"/>
<add name="UserID" defaultValue="ES000" allowAnonymous="true"/>
<add name="Role" defaultValue="user" allowAnonymous="true"/>
<add name="MyThemes" defaultValue="Default" allowAnonymous="true"/>
</properties>
</profile>


If anyone know what's wrong to my code?

Calvin
 
Problem Solved.

Solution: when you click your button you're not yet authenticated. You should try with the event loggedin :

Protected Sub Login1_LoggedIn(ByVal sender As Object, ByVal e As System.EventArgs) Handles Login1.LoggedIn

Profile.xxx = xxx
Profile.Save()


End Sub
 
Back
Top