472,958 Members | 1,874 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 472,958 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 2397
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
by: lllomh | last post by:
Define the method first this.state = { buttonBackgroundColor: 'green', isBlinking: false, // A new status is added to identify whether the button is blinking or not } autoStart=()=>{
2
by: DJRhino | last post by:
Was curious if anyone else was having this same issue or not.... I was just Up/Down graded to windows 11 and now my access combo boxes are not acting right. With win 10 I could start typing...
2
isladogs
by: isladogs | last post by:
The next Access Europe meeting will be on Wednesday 4 Oct 2023 starting at 18:00 UK time (6PM UTC+1) and finishing at about 19:15 (7.15PM) The start time is equivalent to 19:00 (7PM) in Central...
0
tracyyun
by: tracyyun | last post by:
Hello everyone, I have a question and would like some advice on network connectivity. I have one computer connected to my router via WiFi, but I have two other computers that I want to be able to...
2
by: giovanniandrean | last post by:
The energy model is structured as follows and uses excel sheets to give input data: 1-Utility.py contains all the functions needed to calculate the variables and other minor things (mentions...
4
NeoPa
by: NeoPa | last post by:
Hello everyone. I find myself stuck trying to find the VBA way to get Access to create a PDF of the currently-selected (and open) object (Form or Report). I know it can be done by selecting :...
1
by: Teri B | last post by:
Hi, I have created a sub-form Roles. In my course form the user selects the roles assigned to the course. 0ne-to-many. One course many roles. Then I created a report based on the Course form and...
0
isladogs
by: isladogs | last post by:
The next online meeting of the Access Europe User Group will be on Wednesday 6 Dec 2023 starting at 18:00 UK time (6PM UTC) and finishing at about 19:15 (7.15PM). In this month's session, Mike...
2
by: GKJR | last post by:
Does anyone have a recommendation to build a standalone application to replace an Access database? I have my bookkeeping software I developed in Access that I would like to make available to other...

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.