So I’ve made a web app that among other, allows administrators to change user profile data. There is of course a page where user can change his own data, same goes for admins too.
So admin has basically 2 pages where he can change his own data, on User Administration page and My Profile page. Problem occurs when admin changes data on User Administration page it won’t show changes on My Profile, but vise-versa works fine.
I’ve realized that issue lies with the way data is imported. On UA page it goes directly from database, while on My Profile page it goes through a current user session variable I created. So it won’t update it as it should, I’ve gone around and searched for a way to go around this but tough luck so far, so I’d appreciate assistance.
Thank you.
EDIT:
Ok so I create a Session.Item("login") when user logs in, like so:
Context.Session.Add("login", userData)
Where userData is my current user, containing username, password, firstname, lastname etc… An instance of my User class to put it shortly.
Then on my User Control I have in my Page_Load
If Not Page.IsPostBack Then
Dim login As New User
login = Session.Item("login")
PopulateUsersData(login)
End If
I get my data for User Control named My Profile from this. Method PopulateUserData only shows data from login instance to my controls on page.
The Session.Item("login") is the Session variable I wish to update.
Hope this is enough data.
You can fix this by treating the user information in the same way in both places.
You check if the user being edited is the logged in user, if so, update the current logged in info as well as the database entry.