By using this site, you agree to our updated Privacy Policy and our Terms of Use. Manage your Cookies Settings.
435,435 Members | 2,891 Online
Bytes IT Community
+ Ask a Question
Need help? Post your question and get tips & solutions from a community of 435,435 IT Pros & Developers. It's quick & easy.

ASP.NET session management using SQL SERVER

P: n/a
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
Share this Question
Share on Google+
5 Replies


P: n/a
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

P: n/a
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

P: n/a
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

P: n/a
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

P: n/a
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 discussion thread is closed

Replies have been disabled for this discussion.