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

ASP.NET session management using SQL SERVER

This is regarding the session management using Out of
proc session management(SQL SERVER). Among the samples
below which one is better to set the session?

1. There are 20 session variables and all of them
are being stored into session and accessed from session
and individual session object. Example: Session["a"]
= "XYZ", Session["b"]=100, Session["c"]="NAME", etc.
where values are of primitive data type or immediate
derivative of the primitive data types.

2. There are 20 session variable, a custom object is
created out of them. The custom object is stored into the
session. Example: NameValueCollection is an object where
data will be stored as NameValueCollection["a"] = "XYZ",
NameValueCollection["b"]=100, NameValueCollection["c"]
="NAME". Finally while storing it in the session the
NameValueCollection is used as Session["DATA"]=
NameValueCollection.

3)Is there any performance issue due to session
management through SQL SERVER provided by DOTNET framework
Nov 17 '05 #1
5 2420
Some people would disagree, but for the past few years - I pretty much
consider a SQL server an immediate part of my application. If you have a
local, semi-robust SQL server - then making calls (like storing session
information) is pretty negligable..

So, I would say - you should have a SessionID - write that out as a cookie
to the client.. then in a database, you have a SessionID that relates to
whatever session data that you need...

Same with traditional ASP - "Session" variables are really a bad idea. Even
if you are not on a cluster/server farm now - at some point you will, and
that is going to jam up your whole way of dealing with session data. The
Session object stores things on the local server. So in a server farm
scenario.. you go to the alias name, and are connected to server1, session
variables are saved - ON server1. Then you click a link, go to the alias -
and THIS time you go to server2. When it goes to process your request, it
can't - because it's not the server where your session data exists... So,
imho - it's just better to stay away from those and adopt a system that runs
on everything, and even runs when you get into a scenario when you need
highly-available servers...

hth

"Abhilash.k.m" <ab********@indiatimes.com> wrote in message
news:0d****************************@phx.gbl...
This is regarding the session management using Out of
proc session management(SQL SERVER). Among the samples
below which one is better to set the session?

1. There are 20 session variables and all of them
are being stored into session and accessed from session
and individual session object. Example: Session["a"]
= "XYZ", Session["b"]=100, Session["c"]="NAME", etc.
where values are of primitive data type or immediate
derivative of the primitive data types.

2. There are 20 session variable, a custom object is
created out of them. The custom object is stored into the
session. Example: NameValueCollection is an object where
data will be stored as NameValueCollection["a"] = "XYZ",
NameValueCollection["b"]=100, NameValueCollection["c"]
="NAME". Finally while storing it in the session the
NameValueCollection is used as Session["DATA"]=
NameValueCollection.

3)Is there any performance issue due to session
management through SQL SERVER provided by DOTNET framework

Nov 17 '05 #2
I will elaborate my requirments

We are developing a mobile web application using ASP.NET
in a web farm & not planning to use cookies as some
device browser doesn't support the same.So we are doing
the session management with the dot frame work provided
session management using sql server with the values
entered in WEB.CONFIG file.
Now we need to set some 20 values to the session .so my
question is whether we need to add individually as
session values or store all the 20 values as key value
pair(say collections).So which is better 1 0r 2?

1. There are 20 session variables and all of them
are being stored into session and accessed from session
and individual session object. Example: Session["a"]
= "XYZ", Session["b"]=100, Session["c"]="NAME", etc.
where values are of primitive data type or immediate
derivative of the primitive data types.

2. There are 20 session variable, a custom object is created out of them. The custom object is stored into the session. Example: NameValueCollection is an object where data will be stored as NameValueCollection["a"] = "XYZ", NameValueCollection["b"]=100, NameValueCollection["c"]
="NAME". Finally while storing it in the session the
NameValueCollection is used as Session["DATA"]=
NameValueCollection.
-----Original Message-----
Some people would disagree, but for the past few years - I pretty muchconsider a SQL server an immediate part of my application. If you have alocal, semi-robust SQL server - then making calls (like storing sessioninformation) is pretty negligable..

So, I would say - you should have a SessionID - write that out as a cookieto the client.. then in a database, you have a SessionID that relates towhatever session data that you need...

Same with traditional ASP - "Session" variables are really a bad idea. Evenif you are not on a cluster/server farm now - at some point you will, andthat is going to jam up your whole way of dealing with session data. TheSession object stores things on the local server. So in a server farmscenario.. you go to the alias name, and are connected to server1, sessionvariables are saved - ON server1. Then you click a link, go to the alias -and THIS time you go to server2. When it goes to process your request, itcan't - because it's not the server where your session data exists... So,imho - it's just better to stay away from those and adopt a system that runson everything, and even runs when you get into a scenario when you needhighly-available servers...

hth

"Abhilash.k.m" <ab********@indiatimes.com> wrote in messagenews:0d****************************@phx.gbl...
This is regarding the session management using Out of
proc session management(SQL SERVER). Among the samples
below which one is better to set the session?

1. There are 20 session variables and all of them
are being stored into session and accessed from session
and individual session object. Example: Session["a"]
= "XYZ", Session["b"]=100, Session["c"]="NAME", etc.
where values are of primitive data type or immediate
derivative of the primitive data types.

2. There are 20 session variable, a custom object

is created out of them. The custom object is stored into the session. Example: NameValueCollection is an object where data will be stored as NameValueCollection["a"] = "XYZ", NameValueCollection["b"]=100, NameValueCollection["c"]
="NAME". Finally while storing it in the session the
NameValueCollection is used as Session["DATA"]=
NameValueCollection.

3)Is there any performance issue due to session
management through SQL SERVER provided by DOTNET framework

.

Nov 17 '05 #3
In that case, I'd say a collection or an array would be ideal - because you
can easily iterate through the elements..

"Abhilash.K.M" <ab********@indiatimes.com> wrote in message
news:07****************************@phx.gbl...
I will elaborate my requirments

We are developing a mobile web application using ASP.NET
in a web farm & not planning to use cookies as some
device browser doesn't support the same.So we are doing
the session management with the dot frame work provided
session management using sql server with the values
entered in WEB.CONFIG file.
Now we need to set some 20 values to the session .so my
question is whether we need to add individually as
session values or store all the 20 values as key value
pair(say collections).So which is better 1 0r 2?

1. There are 20 session variables and all of them
are being stored into session and accessed from session
and individual session object. Example: Session["a"]
= "XYZ", Session["b"]=100, Session["c"]="NAME", etc.
where values are of primitive data type or immediate
derivative of the primitive data types.

2. There are 20 session variable, a custom object is created out of them. The custom object is stored into the session. Example: NameValueCollection is an object where data will be stored as NameValueCollection["a"] = "XYZ", NameValueCollection["b"]=100, NameValueCollection["c"]
="NAME". Finally while storing it in the session the
NameValueCollection is used as Session["DATA"]=
NameValueCollection.
-----Original Message-----
Some people would disagree, but for the past few years -

I pretty much
consider a SQL server an immediate part of my

application. If you have a
local, semi-robust SQL server - then making calls (like

storing session
information) is pretty negligable..

So, I would say - you should have a SessionID - write

that out as a cookie
to the client.. then in a database, you have a SessionID

that relates to
whatever session data that you need...

Same with traditional ASP - "Session" variables are

really a bad idea. Even
if you are not on a cluster/server farm now - at some

point you will, and
that is going to jam up your whole way of dealing with

session data. The
Session object stores things on the local server. So in

a server farm
scenario.. you go to the alias name, and are connected

to server1, session
variables are saved - ON server1. Then you click a link,

go to the alias -
and THIS time you go to server2. When it goes to process

your request, it
can't - because it's not the server where your session

data exists... So,
imho - it's just better to stay away from those and

adopt a system that runs
on everything, and even runs when you get into a

scenario when you need
highly-available servers...

hth

"Abhilash.k.m" <ab********@indiatimes.com> wrote in

message
news:0d****************************@phx.gbl...
This is regarding the session management using Out of
proc session management(SQL SERVER). Among the samples
below which one is better to set the session?

1. There are 20 session variables and all of them
are being stored into session and accessed from session
and individual session object. Example: Session["a"]
= "XYZ", Session["b"]=100, Session["c"]="NAME", etc.
where values are of primitive data type or immediate
derivative of the primitive data types.

2. There are 20 session variable, a custom object

is created out of them. The custom object is stored into the session. Example: NameValueCollection is an object where data will be stored as NameValueCollection["a"] = "XYZ", NameValueCollection["b"]=100, NameValueCollection["c"]
="NAME". Finally while storing it in the session the
NameValueCollection is used as Session["DATA"]=
NameValueCollection.

3)Is there any performance issue due to session
management through SQL SERVER provided by DOTNET framework

.

Nov 17 '05 #4
I agree. I've had good luck even using DataTables and DataSets in Session
variables.

"Frank Drebin" <no*****@imsickofspam.com> wrote in message
news:cV**********************@newssvr28.news.prodi gy.com...
In that case, I'd say a collection or an array would be ideal - because you can easily iterate through the elements..

"Abhilash.K.M" <ab********@indiatimes.com> wrote in message
news:07****************************@phx.gbl...
I will elaborate my requirments

We are developing a mobile web application using ASP.NET
in a web farm & not planning to use cookies as some
device browser doesn't support the same.So we are doing
the session management with the dot frame work provided
session management using sql server with the values
entered in WEB.CONFIG file.
Now we need to set some 20 values to the session .so my
question is whether we need to add individually as
session values or store all the 20 values as key value
pair(say collections).So which is better 1 0r 2?

1. There are 20 session variables and all of them
> are being stored into session and accessed from session
> and individual session object. Example: Session["a"]
> = "XYZ", Session["b"]=100, Session["c"]="NAME", etc.
> where values are of primitive data type or immediate
> derivative of the primitive data types.
>
> 2. There are 20 session variable, a custom object

is
> created out of them. The custom object is stored into

the
> session. Example: NameValueCollection is an object

where
> data will be stored as NameValueCollection["a"]

= "XYZ",
> NameValueCollection["b"]=100, NameValueCollection["c"]
> ="NAME". Finally while storing it in the session the
> NameValueCollection is used as Session["DATA"]=
> NameValueCollection.


-----Original Message-----
Some people would disagree, but for the past few years -

I pretty much
consider a SQL server an immediate part of my

application. If you have a
local, semi-robust SQL server - then making calls (like

storing session
information) is pretty negligable..

So, I would say - you should have a SessionID - write

that out as a cookie
to the client.. then in a database, you have a SessionID

that relates to
whatever session data that you need...

Same with traditional ASP - "Session" variables are

really a bad idea. Even
if you are not on a cluster/server farm now - at some

point you will, and
that is going to jam up your whole way of dealing with

session data. The
Session object stores things on the local server. So in

a server farm
scenario.. you go to the alias name, and are connected

to server1, session
variables are saved - ON server1. Then you click a link,

go to the alias -
and THIS time you go to server2. When it goes to process

your request, it
can't - because it's not the server where your session

data exists... So,
imho - it's just better to stay away from those and

adopt a system that runs
on everything, and even runs when you get into a

scenario when you need
highly-available servers...

hth

"Abhilash.k.m" <ab********@indiatimes.com> wrote in

message
news:0d****************************@phx.gbl...
> This is regarding the session management using Out of
> proc session management(SQL SERVER). Among the samples
> below which one is better to set the session?
>
>
>
> 1. There are 20 session variables and all of them
> are being stored into session and accessed from session
> and individual session object. Example: Session["a"]
> = "XYZ", Session["b"]=100, Session["c"]="NAME", etc.
> where values are of primitive data type or immediate
> derivative of the primitive data types.
>
> 2. There are 20 session variable, a custom object

is
> created out of them. The custom object is stored into

the
> session. Example: NameValueCollection is an object

where
> data will be stored as NameValueCollection["a"]

= "XYZ",
> NameValueCollection["b"]=100, NameValueCollection["c"]
> ="NAME". Finally while storing it in the session the
> NameValueCollection is used as Session["DATA"]=
> NameValueCollection.
>
> 3)Is there any performance issue due to session
> management through SQL SERVER provided by DOTNET

framework
>
>
.


Nov 17 '05 #5
I agree. I've had good luck even using DataTables and DataSets in Session
variables.

"Frank Drebin" <no*****@imsickofspam.com> wrote in message
news:cV**********************@newssvr28.news.prodi gy.com...
In that case, I'd say a collection or an array would be ideal - because you can easily iterate through the elements..

"Abhilash.K.M" <ab********@indiatimes.com> wrote in message
news:07****************************@phx.gbl...
I will elaborate my requirments

We are developing a mobile web application using ASP.NET
in a web farm & not planning to use cookies as some
device browser doesn't support the same.So we are doing
the session management with the dot frame work provided
session management using sql server with the values
entered in WEB.CONFIG file.
Now we need to set some 20 values to the session .so my
question is whether we need to add individually as
session values or store all the 20 values as key value
pair(say collections).So which is better 1 0r 2?

1. There are 20 session variables and all of them
> are being stored into session and accessed from session
> and individual session object. Example: Session["a"]
> = "XYZ", Session["b"]=100, Session["c"]="NAME", etc.
> where values are of primitive data type or immediate
> derivative of the primitive data types.
>
> 2. There are 20 session variable, a custom object

is
> created out of them. The custom object is stored into

the
> session. Example: NameValueCollection is an object

where
> data will be stored as NameValueCollection["a"]

= "XYZ",
> NameValueCollection["b"]=100, NameValueCollection["c"]
> ="NAME". Finally while storing it in the session the
> NameValueCollection is used as Session["DATA"]=
> NameValueCollection.


-----Original Message-----
Some people would disagree, but for the past few years -

I pretty much
consider a SQL server an immediate part of my

application. If you have a
local, semi-robust SQL server - then making calls (like

storing session
information) is pretty negligable..

So, I would say - you should have a SessionID - write

that out as a cookie
to the client.. then in a database, you have a SessionID

that relates to
whatever session data that you need...

Same with traditional ASP - "Session" variables are

really a bad idea. Even
if you are not on a cluster/server farm now - at some

point you will, and
that is going to jam up your whole way of dealing with

session data. The
Session object stores things on the local server. So in

a server farm
scenario.. you go to the alias name, and are connected

to server1, session
variables are saved - ON server1. Then you click a link,

go to the alias -
and THIS time you go to server2. When it goes to process

your request, it
can't - because it's not the server where your session

data exists... So,
imho - it's just better to stay away from those and

adopt a system that runs
on everything, and even runs when you get into a

scenario when you need
highly-available servers...

hth

"Abhilash.k.m" <ab********@indiatimes.com> wrote in

message
news:0d****************************@phx.gbl...
> This is regarding the session management using Out of
> proc session management(SQL SERVER). Among the samples
> below which one is better to set the session?
>
>
>
> 1. There are 20 session variables and all of them
> are being stored into session and accessed from session
> and individual session object. Example: Session["a"]
> = "XYZ", Session["b"]=100, Session["c"]="NAME", etc.
> where values are of primitive data type or immediate
> derivative of the primitive data types.
>
> 2. There are 20 session variable, a custom object

is
> created out of them. The custom object is stored into

the
> session. Example: NameValueCollection is an object

where
> data will be stored as NameValueCollection["a"]

= "XYZ",
> NameValueCollection["b"]=100, NameValueCollection["c"]
> ="NAME". Finally while storing it in the session the
> NameValueCollection is used as Session["DATA"]=
> NameValueCollection.
>
> 3)Is there any performance issue due to session
> management through SQL SERVER provided by DOTNET

framework
>
>
.


Nov 17 '05 #6

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

Similar topics

27
by: mrbog | last post by:
Tell me if my assertion is wrong here: The only way to prevent session hijacking is to NEVER store authentication information (such as name/password) in the session. Well, to never authenticate...
30
by: Robert Tweed | last post by:
Does anyone know a good resource discussing the issues involved in session theft? I've read a couple, but none that really address the problem apart from acknowledging that it is a problem; you...
1
by: Akshay Kumar | last post by:
Hi All, I was reading Perforance and Scalability Guide and reading Session State Management section. It says use SQL Server when using Web farm . No where are the metrics and the Why's are...
2
by: John A Grandy | last post by:
for high traffic public websites , what are the proven options for session-state storage & management ? is an out-of-process state-server generally preferred over a sql-server ? what are the...
13
by: James Hunter Ross | last post by:
We love the ASP.NET "Session" concept and make good use of it. But, getting close to deployment we find we lose sessions far too often, probably due to application restarts, etc. We hope to...
2
by: satisharas | last post by:
Hello, I am trying to write a custom session manager in ASP.NET 2.0 using oracle as the backend. I want to know how the session expires in web garden and we are using NLB (a session can be...
5
by: rug | last post by:
Hello, I want to use a MySQL Heap table (server load isn't an issue) for session management considering that I use a shared server and don't want anyone who has access to /tmp to be able to read...
14
by: GaryDean | last post by:
The web.config in my asp.net application, running on Server2003, has this entry: <sessionState mode="InProc" timeout="40". In IIS the asp.net State Management timeout setting is 40 for my website....
0
isladogs
by: isladogs | last post by:
The next Access Europe meeting will be on Wednesday 6 Mar 2024 starting at 18:00 UK time (6PM UTC) and finishing at about 19:15 (7.15PM). In this month's session, we are pleased to welcome back...
0
by: ArrayDB | last post by:
The error message I've encountered is; ERROR:root:Error generating model response: exception: access violation writing 0x0000000000005140, which seems to be indicative of an access violation...
1
by: PapaRatzi | last post by:
Hello, I am teaching myself MS Access forms design and Visual Basic. I've created a table to capture a list of Top 30 singles and forms to capture new entries. The final step is a form (unbound)...
1
by: CloudSolutions | last post by:
Introduction: For many beginners and individual users, requiring a credit card and email registration may pose a barrier when starting to use cloud servers. However, some cloud server providers now...
1
by: Defcon1945 | last post by:
I'm trying to learn Python using Pycharm but import shutil doesn't work
1
by: Shællîpôpï 09 | last post by:
If u are using a keypad phone, how do u turn on JavaScript, to access features like WhatsApp, Facebook, Instagram....
0
by: af34tf | last post by:
Hi Guys, I have a domain whose name is BytesLimited.com, and I want to sell it. Does anyone know about platforms that allow me to list my domain in auction for free. Thank you
0
by: Faith0G | last post by:
I am starting a new it consulting business and it's been a while since I setup a new website. Is wordpress still the best web based software for hosting a 5 page website? The webpages will be...
0
isladogs
by: isladogs | last post by:
The next Access Europe User Group meeting will be on Wednesday 3 Apr 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 former...

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.