Results 1 to 13 of 13

Thread: [RESOLVED] saving global parameters Best approach ?

  1. #1

    Thread Starter
    PowerPoster motil's Avatar
    Join Date
    Apr 2009
    Location
    Tel Aviv, Israel
    Posts
    2,143

    Resolved [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

  2. #2
    Frenzied Member avrail's Avatar
    Join Date
    Mar 2006
    Location
    Egypt, Cairo
    Posts
    1,221

    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

  3. #3
    PowerPoster gep13's Avatar
    Join Date
    Nov 2004
    Location
    The Granite City
    Posts
    21,963

    Re: saving global parameters Best approach ?

    Ok motil, you lost me

    What exactly are you trying to do.

    Gary

  4. #4

    Thread Starter
    PowerPoster motil's Avatar
    Join Date
    Apr 2009
    Location
    Tel Aviv, Israel
    Posts
    2,143

    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

  5. #5
    PowerPoster gep13's Avatar
    Join Date
    Nov 2004
    Location
    The Granite City
    Posts
    21,963

    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

  6. #6

    Thread Starter
    PowerPoster motil's Avatar
    Join Date
    Apr 2009
    Location
    Tel Aviv, Israel
    Posts
    2,143

    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

  7. #7
    PowerPoster gep13's Avatar
    Join Date
    Nov 2004
    Location
    The Granite City
    Posts
    21,963

    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

  8. #8

    Thread Starter
    PowerPoster motil's Avatar
    Join Date
    Apr 2009
    Location
    Tel Aviv, Israel
    Posts
    2,143

    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

  9. #9
    PowerPoster gep13's Avatar
    Join Date
    Nov 2004
    Location
    The Granite City
    Posts
    21,963

    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

  10. #10

    Thread Starter
    PowerPoster motil's Avatar
    Join Date
    Apr 2009
    Location
    Tel Aviv, Israel
    Posts
    2,143

    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

  11. #11
    PowerPoster gep13's Avatar
    Join Date
    Nov 2004
    Location
    The Granite City
    Posts
    21,963

    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

  12. #12

    Thread Starter
    PowerPoster motil's Avatar
    Join Date
    Apr 2009
    Location
    Tel Aviv, Israel
    Posts
    2,143

    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

  13. #13
    PowerPoster gep13's Avatar
    Join Date
    Nov 2004
    Location
    The Granite City
    Posts
    21,963

    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
  •  



Click Here to Expand Forum to Full Width