473,404 Members | 2,137 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,404 software developers and data experts.

Session variables

Hi,

Is there any know problem using session variables ?
My website won't have more than 20 simultaneous connections, and i would
like to use 5 session variables containing strings...
I know than with ASP, it was not really recommended, what about ASP.NET ?

Thanks !
Nov 19 '05 #1
7 1831
There's nothing wrong with using them, but there are better alternatives.
"Gerald" <an******@nospam.com> wrote in message
news:es**************@TK2MSFTNGP09.phx.gbl...
Hi,

Is there any know problem using session variables ?
My website won't have more than 20 simultaneous connections, and i would
like to use 5 session variables containing strings...
I know than with ASP, it was not really recommended, what about ASP.NET ?

Thanks !

Nov 19 '05 #2
Nothing wrong with them in ASP and there is nothing wrong with them in
ASP.NET.
Particularly value types like strings and ints.

--
2005 Microsoft MVP C#
Robbe Morris
http://www.robbemorris.com
http://www.masterado.net/home/listings.aspx

"Gerald" <an******@nospam.com> wrote in message
news:es**************@TK2MSFTNGP09.phx.gbl...
Hi,

Is there any know problem using session variables ?
My website won't have more than 20 simultaneous connections, and i would
like to use 5 session variables containing strings...
I know than with ASP, it was not really recommended, what about ASP.NET ?

Thanks !

Nov 19 '05 #3
Thanks, wich alternatives are better ?
Nov 19 '05 #4
"Gerald" wrote:
Hi,

Is there any know problem using session variables ?
My website won't have more than 20 simultaneous connections, and i would
like to use 5 session variables containing strings...
I know than with ASP, it was not really recommended, what about ASP.NET ?

Thanks !


Hi, i wouldnt call them problems, theres just stuff to be aware of. Like if
your site is spread across a web farm, youll need to use an out-of-process
session state instead of in-process. Also if that server gets rebooted then
ppl will lose their session state. But if theres only going to be 20 users
and 1 web server then there shouldnt otherwise be any real negatives to using
session state, as long as that server isnt running w/ 128MB of RAM!

HTH
Nov 19 '05 #5
Writing to a database, rather than saving per-user values in memory and
potentially needing to save huge amounts of data in RAM.

Using cookies for non-critical application data.
"Gerald" <an******@nospam.com> wrote in message
news:ud**************@TK2MSFTNGP15.phx.gbl...
Thanks, wich alternatives are better ?

Nov 19 '05 #6
Hello Scott M.,

At which point you're just offloading the bottleneck, right? Writing to/reading
from a database is one of the most expensive operations you can perform.

The true answer here is that Session variables used judiciously are ok. Issues
will come up if you do things such as storing every little detail in Session
or need to have session access across a web farm.

--
Matt Berther
http://www.mattberther.com
Writing to a database, rather than saving per-user values in memory
and potentially needing to save huge amounts of data in RAM.

Using cookies for non-critical application data.

"Gerald" <an******@nospam.com> wrote in message
news:ud**************@TK2MSFTNGP15.phx.gbl...
Thanks, wich alternatives are better ?


Nov 19 '05 #7
Reading/Writing to a DB is not the CPU and bandwidth hog that it once was.
This solution is widely considered to be the most stable and robust way to
persist state.

Now, should it be used to store short-term data or for every piece of data
needing to be persisted? No, and I never said it should be. I only said
that there are better alternatives to sessions (which, by the way, may not
even be an option since many web server admins turn off the server's ability
to use sessions because of the tendency to over use them or use them
incorrectly).

The *true* answer is that there is no one solution. The best sites use a
bit of several techniques where it makes sense to do so. I love using
cookies because it "off-loads" the storage to the client. But, as you know,
cookies can be turned off at the client level (as well as them being
susceptible to corruption). So, I only use them for non-critical data
storage like storing a user's preferences.

Sessions are easy enough to use, but can cause serious memory issues on the
server (even if they are used sparingly in code). Additionally, when a
client turns off cookies, they may also be turning of "per session cookies"
which means that server sessions are effectively turned off as well. Not to
mention the issues that come up with the use of sessions in web farm
environments.

Hidden form fields and querystrings are other ways to move data around but
they are also susceptible to corruption and querystrings in particular have
limits on the amount of data that can be passed.

So now we come to database storage....This can not be turned off by the
client, so it is reliable. There are no practical limits on the amount of
data that can be stored. Web Farm situations don't impact their use. The
possibilities of data loss due to a server crashing are eliminated, etc.,
etc., etc. Because we live in a world with faster servers and higher
bandwidth that ever before, using a database for persisting data is not the
taboo that it once was. Today, it is widely considered to be the "only"
choice by many serious web developers.

"Matt Berther" <mb******@hotmail.com> wrote in message
news:22***************************@news.microsoft. com...
Hello Scott M.,

At which point you're just offloading the bottleneck, right? Writing
to/reading from a database is one of the most expensive operations you can
perform.

The true answer here is that Session variables used judiciously are ok.
Issues will come up if you do things such as storing every little detail
in Session or need to have session access across a web farm.

--
Matt Berther
http://www.mattberther.com
Writing to a database, rather than saving per-user values in memory
and potentially needing to save huge amounts of data in RAM.

Using cookies for non-critical application data.

"Gerald" <an******@nospam.com> wrote in message
news:ud**************@TK2MSFTNGP15.phx.gbl...
Thanks, wich alternatives are better ?


Nov 19 '05 #8

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...
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...
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...
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...
3
by: veenna | last post by:
Hi all, I have a page in asp.net. A button click in the page will open a pop-up. I have used btn.attributes.add("onclick", ""); to open the pop-up. Now if session is expired, it is opening the...
0
by: emmanuelkatto | last post by:
Hi All, I am Emmanuel katto from Uganda. I want to ask what challenges you've faced while migrating a website to cloud. Please let me know. Thanks! Emmanuel
1
by: nemocccc | last post by:
hello, everyone, I want to develop a software for my android phone for daily needs, any suggestions?
1
by: Sonnysonu | last post by:
This is the data of csv file 1 2 3 1 2 3 1 2 3 1 2 3 2 3 2 3 3 the lengths should be different i have to store the data by column-wise with in the specific length. suppose the i have to...
0
by: Hystou | last post by:
There are some requirements for setting up RAID: 1. The motherboard and BIOS support RAID configuration. 2. The motherboard has 2 or more available SATA protocol SSD/HDD slots (including MSATA, M.2...
0
marktang
by: marktang | last post by:
ONU (Optical Network Unit) is one of the key components for providing high-speed Internet services. Its primary function is to act as an endpoint device located at the user's premises. However,...
0
by: Hystou | last post by:
Most computers default to English, but sometimes we require a different language, especially when relocating. Forgot to request a specific language before your computer shipped? No problem! You can...
0
by: Hystou | last post by:
Overview: Windows 11 and 10 have less user interface control over operating system update behaviour than previous versions of Windows. In Windows 11 and 10, there is no way to turn off the Windows...
0
agi2029
by: agi2029 | last post by:
Let's talk about the concept of autonomous AI software engineers and no-code agents. These AIs are designed to manage the entire lifecycle of a software development project—planning, coding, testing,...
0
isladogs
by: isladogs | last post by:
The next Access Europe User Group meeting will be on Wednesday 1 May 2024 starting at 18:00 UK time (6PM UTC+1) and finishing by 19:30 (7.30PM). In this session, we are pleased to welcome a new...

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.