473,236 Members | 1,550 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,236 software developers and data experts.

session variables

Hi all,

I have read much about session variables and the pros and cons. I want
to post my use and get opinions.

When a user logs into my site various fields are pulled from a SQL
user table. I store the user's name, ID, country, region, site code,
and access level in session variables.

I use this information to decide what fields the user can see, what he
can do, or how the fields are prepopulated.

Am I sacrificing performance? Suggestions? To me this is not overusing
session variables.

Thanks in advance.
Nov 18 '05 #1
3 1563
Hi Matt,

This is certainly one of the things that Session is useful for - any time
you need to store user-specific information across page requests. The only
caveat I can give you is that you will need to handle the eventuality that a
user will step out for 20 minutes, come back, and their Session has ended.
Make sure that you include a way of recovering it.

--
HTH,
Kevin Spencer
..Net Developer
Microsoft MVP
Big things are made up
of lots of little things.

"Matt Mercer" <ma******@bellsouth.net> wrote in message
news:37**************************@posting.google.c om...
Hi all,

I have read much about session variables and the pros and cons. I want
to post my use and get opinions.

When a user logs into my site various fields are pulled from a SQL
user table. I store the user's name, ID, country, region, site code,
and access level in session variables.

I use this information to decide what fields the user can see, what he
can do, or how the fields are prepopulated.

Am I sacrificing performance? Suggestions? To me this is not overusing
session variables.

Thanks in advance.

Nov 18 '05 #2
Matt,

In my experience, that's a pretty minimal amount of information for a large
group of users. It becomes expensive when you create class objects with much
greater content (e.g. a collection(s) of data from a database).
"Matt Mercer" wrote:
Hi all,

I have read much about session variables and the pros and cons. I want
to post my use and get opinions.

When a user logs into my site various fields are pulled from a SQL
user table. I store the user's name, ID, country, region, site code,
and access level in session variables.

I use this information to decide what fields the user can see, what he
can do, or how the fields are prepopulated.

Am I sacrificing performance? Suggestions? To me this is not overusing
session variables.

Thanks in advance.

Nov 18 '05 #3
It depends on the demand on your system, ram and the amount of expected
load.

In the old days session variables were looked at as the great evil. There
reason was that they consumed resources (ram) and reduced the scalability of
the site along with being a major problem on a web farm. In ASP.NET it is
not exactly the case. Just about any site that using session state is still
scalable, since we now have the ability to use a SQL Server base for session
state storage which solves the problems with web farms and sessions expiring
along with relieving some concerns about memory usage.

That said, you really only want to store information in session state that
is user and session specific, not page specific. While many people only use
one browser window, they may use more than one and if they do your session
state will be shared among them. Thus if you have something page specific,
it may be written over by another browser window the person is using.

Currently, most will use ViewState or a database to store page specific data
although you can handle ViewState and store it in a database if you like.
Very flexible, that should be part of the name .(VeryFlexible)Net

As mentioned in another message, I would use a single class to handle the
session state to make it more abstracted in your code.

--
Rocky Moore
www.HintsAndTips.com / Now with GMail Queue - Share your tips - Earn rewards
www.MyQuickPoll.com / 2004 Election poll ID #33
www.RJSoft.com/Products/RJContentPanel/ - Free web user template content
control!

"Matt Mercer" <ma******@bellsouth.net> wrote in message
news:37**************************@posting.google.c om...
Hi all,

I have read much about session variables and the pros and cons. I want
to post my use and get opinions.

When a user logs into my site various fields are pulled from a SQL
user table. I store the user's name, ID, country, region, site code,
and access level in session variables.

I use this information to decide what fields the user can see, what he
can do, or how the fields are prepopulated.

Am I sacrificing performance? Suggestions? To me this is not overusing
session variables.

Thanks in advance.

Nov 18 '05 #4

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

6
by: Al Jones | last post by:
This is a repost form the vbscript newgroup - if this isn't the appropriate group would you point me toward one that is. Basically, I seem to be losing session data part way though preparing an...
6
by: Lina Manjarres | last post by:
Hello, I have a session variable in a login page. Then I go to a form page where I uses the ProfileID and the UserID. Then I go to a result page where I would like to use the UserID as a filter,...
4
by: PJ | last post by:
A particular page seems to be having issues with correctly setting Session variables. I am setting a couple of session variables on the Page_Unload event. While stepping through code, the...
31
by: Harry Simpson | last post by:
I've come from the old ASP camp where session variables were not used. When i started using ASP.NET in 2001, I started using them again because it was ok from what I'd read. I've been merrily...
10
by: tshad | last post by:
I have been using the default session state (InProc) and have found that I have been loosing my information after a period of time (normally 20 minutes). Is there anyway to find out how much...
3
by: Alan Wang | last post by:
Hi there, Once my application gets complicated and complicated. I found it's really hard to keep track of Session value I am using in my asp.net application. I am just wondering if anyone have...
3
by: Phillip N Rounds | last post by:
I'm writing a user control which has two states: Active & InActive. I additionally am required that there to be only one active control per page, and all logic has to be contained within the...
18
by: BillE | last post by:
When a user opens a new IE browser window using File-New-Window the integrity of an application which relies on session state is COMPLETELY undermined. Anyone who overlooks the fact that...
26
by: BillE | last post by:
Some ASP.NET applications use Session Variables extensively to maintain state. These should be re-written to use viewstate, hidden fields, querystring, etc. instead. This is because if a user...
12
by: MrHelpMe | last post by:
Hello again all, I've finished my whole application and now I don't like the whole session variables that I am using. I have a form, user fills in info clicks submit and using CDOSYSMail an...
3
isladogs
by: isladogs | last post by:
The next Access Europe meeting will be on Wednesday 3 Jan 2024 starting at 18:00 UK time (6PM UTC) and finishing at about 19:15 (7.15PM). For other local times, please check World Time Buddy In...
0
by: abbasky | last post by:
### Vandf component communication method one: data sharing ​ Vandf components can achieve data exchange through data sharing, state sharing, events, and other methods. Vandf's data exchange method...
2
isladogs
by: isladogs | last post by:
The next Access Europe meeting will be on Wednesday 7 Feb 2024 starting at 18:00 UK time (6PM UTC) and finishing at about 19:30 (7.30PM). In this month's session, the creator of the excellent VBE...
0
by: fareedcanada | last post by:
Hello I am trying to split number on their count. suppose i have 121314151617 (12cnt) then number should be split like 12,13,14,15,16,17 and if 11314151617 (11cnt) then should be split like...
0
by: stefan129 | last post by:
Hey forum members, I'm exploring options for SSL certificates for multiple domains. Has anyone had experience with multi-domain SSL certificates? Any recommendations on reliable providers or specific...
0
Git
by: egorbl4 | last post by:
Скачал я git, хотел начать настройку, а там вылезло вот это Что это? Что мне с этим делать? ...
0
by: MeoLessi9 | last post by:
I have VirtualBox installed on Windows 11 and now I would like to install Kali on a virtual machine. However, on the official website, I see two options: "Installer images" and "Virtual machines"....
0
by: DolphinDB | last post by:
The formulas of 101 quantitative trading alphas used by WorldQuant were presented in the paper 101 Formulaic Alphas. However, some formulas are complex, leading to challenges in calculation. Take...
0
by: DolphinDB | last post by:
Tired of spending countless mintues downsampling your data? Look no further! In this article, you’ll learn how to efficiently downsample 6.48 billion high-frequency records to 61 million...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.