|
-
Aug 5th, 2010, 05:23 AM
#1
[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?
* Rate It  If you Like it
__________________________________________________________________________________________
" Programming is like sex: one mistake and you’re providing support for a lifetime."
Get last SQL insert ID 
-
Aug 5th, 2010, 05:35 AM
#2
Frenzied Member
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
You Don't Have to Rate Me.
I'm Not a Civilized Man I'm the Civilization it self
White or Black, Living or Dieing and 0 or 1 that's MY life
iam an Object in Object Oriented Life
my blog : http://refateid.blogspot.com/
twitter : @avrail
010011000111010101110110001000000100110101111001001000000101000001100011 
-
Aug 5th, 2010, 05:39 AM
#3
Re: saving global parameters Best approach ?
Ok motil, you lost me 
What exactly are you trying to do.
Gary
-
Aug 5th, 2010, 05:51 AM
#4
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
* Rate It  If you Like it
__________________________________________________________________________________________
" Programming is like sex: one mistake and you’re providing support for a lifetime."
Get last SQL insert ID 
-
Aug 5th, 2010, 05:56 AM
#5
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
-
Aug 5th, 2010, 06:07 AM
#6
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
* Rate It  If you Like it
__________________________________________________________________________________________
" Programming is like sex: one mistake and you’re providing support for a lifetime."
Get last SQL insert ID 
-
Feb 20th, 2011, 06:12 AM
#7
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
-
Feb 20th, 2011, 06:58 AM
#8
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 ?
* Rate It  If you Like it
__________________________________________________________________________________________
" Programming is like sex: one mistake and you’re providing support for a lifetime."
Get last SQL insert ID 
-
Feb 20th, 2011, 08:01 AM
#9
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
-
Feb 20th, 2011, 08:07 AM
#10
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 ?
* Rate It  If you Like it
__________________________________________________________________________________________
" Programming is like sex: one mistake and you’re providing support for a lifetime."
Get last SQL insert ID 
-
Feb 20th, 2011, 08:22 AM
#11
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
-
Feb 20th, 2011, 08:25 AM
#12
Re: saving global parameters Best approach ?
yep just as I thought.
Thanks again for the info Gary.
* Rate It  If you Like it
__________________________________________________________________________________________
" Programming is like sex: one mistake and you’re providing support for a lifetime."
Get last SQL insert ID 
-
Feb 20th, 2011, 08:25 AM
#13
Re: [RESOLVED] saving global parameters Best approach ?
Not a problem at all!
Gary
Posting Permissions
- You may not post new threads
- You may not post replies
- You may not post attachments
- You may not edit your posts
-
Forum Rules
|
Click Here to Expand Forum to Full Width
|