[RESOLVED] saving global parameters Best approach ?
Hello,
I'm just about hitting the logging page of our company new website, every user has his own settings of restrictions, since i don't want to load those values from the database in each page, my current idea is to save it once he log in in a session as a class of "Employee" and use them at will.
is this consider good approach or should i go another way?
Re: saving global parameters Best approach ?
hay,
you need it per user, then the Session will be your best way
but, be a ware if the user Session timeout was finished, you should send the user back to your login,
and also, the data that will be stored into your session must be cleared from Session after you getting your data from it, and once the user logged out clear his session
Re: saving global parameters Best approach ?
Ok motil, you lost me :)
What exactly are you trying to do.
Gary
Re: saving global parameters Best approach ?
@avaril, thanks i'm aware of the limitations of sessions.
@Gary, well once our users logs in user from company A should see in their menu option a, option b and option c, while users of company B would see only options A,D and E,
also company A users can view page X and Y and company B users can only view Page A
so my thought was to save all these details in a class and store it in session is this good approach?
if you need more explanations just say :)
Re: saving global parameters Best approach ?
If you are trying to prevent access to pages, and to restrict menu items, why not use the built in features of roles to do this.
You can see an example of this happening in the link in my signature about Restricted Menus.
Gary
Re: saving global parameters Best approach ?
Thanks for the link, some questions Gary:
how flexible this feature ? would i have total control and would be able to set things exactly how i want just like i built it from scratch?
our site is about 75% Ajax and not the built in ASP.NET ajax (update panel / script manager) i don't use those controls (too heavy poor performance) it's 100% jquery - ajax will i still be able to control it ? now that i think about it i don't think so, cause jq ajax means postback to static methods which means i don't have access to the page controls .
if i'll pass the built in control and do one of my own would you recommend using the session idea or should i do it another way?
btw, do you have any idea how the built in control saving all the access / restrictions parameters? i don't believe it goes to the DB on each page
Re: saving global parameters Best approach ?
Hey motil,
I have just realised, but going through some old emails that I didn't reply to this thread! Sorry about that!! Did you get an answer to your question, or did you move onto a different approach?
Gary
Re: saving global parameters Best approach ?
Hi Gary.
this thread is closely related to this this thread http://www.vbforums.com/showthread.php?t=640951
where I talk about using sessions (class that use sessions) to save user preferences.
as I wrote their, I ended up building this class that maintains the user preferences and other basic information using sessions, and it's working superb, I now knows there is a built-in ASP.NET mechanism to do this type of things (membership profile / provider) ? I still didn't had the chance to really read and learn about it too much, one thing that I really want to know about this feature is how ASP.NET accessing the user preferences in each page, database ? sessions ? I decide ?
Re: saving global parameters Best approach ?
Hey,
If you use the Profile Provider, then the users profile settings are persisted into the aspnet database, and retrieved, when needed, by the provider, based on the currently logged in user.
Gary
Re: saving global parameters Best approach ?
so, if i need to pull user information in each page (like user name, website skin color, permissions etc..)then the users profiler will access the database over and over to pull the same information ?
Re: saving global parameters Best approach ?
Hey,
It is possible to create a class, which represents the contents of that users profile information. Once you have that, you can then do whatever you want with it to keep to "handy", i.e. throw it into a session variable etc.
Gary
Re: saving global parameters Best approach ?
yep just as I thought.
Thanks again for the info Gary.
Re: [RESOLVED] saving global parameters Best approach ?
Not a problem at all!
Gary