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 | | | | re: ASP.NET session management using SQL SERVER
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" <abhilashkm@indiatimes.com> wrote in message
news:0d7c01c36b53$aef58750$a001280a@phx.gbl...[color=blue]
> 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
>
>[/color] | | | | re: ASP.NET session management using SQL SERVER
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[color=blue][color=green]
>> 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[/color][/color]
is[color=blue][color=green]
>> created out of them. The custom object is stored into[/color][/color]
the[color=blue][color=green]
>> session. Example: NameValueCollection is an object[/color][/color]
where[color=blue][color=green]
>> data will be stored as NameValueCollection["a"][/color][/color]
= "XYZ",[color=blue][color=green]
>> NameValueCollection["b"]=100, NameValueCollection["c"]
>> ="NAME". Finally while storing it in the session the
>> NameValueCollection is used as Session["DATA"]=
>> NameValueCollection.[/color][/color]
[color=blue]
>-----Original Message-----
>Some people would disagree, but for the past few years -[/color]
I pretty much[color=blue]
>consider a SQL server an immediate part of my[/color]
application. If you have a[color=blue]
>local, semi-robust SQL server - then making calls (like[/color]
storing session[color=blue]
>information) is pretty negligable..
>
>So, I would say - you should have a SessionID - write[/color]
that out as a cookie[color=blue]
>to the client.. then in a database, you have a SessionID[/color]
that relates to[color=blue]
>whatever session data that you need...
>
>Same with traditional ASP - "Session" variables are[/color]
really a bad idea. Even[color=blue]
>if you are not on a cluster/server farm now - at some[/color]
point you will, and[color=blue]
>that is going to jam up your whole way of dealing with[/color]
session data. The[color=blue]
>Session object stores things on the local server. So in[/color]
a server farm[color=blue]
>scenario.. you go to the alias name, and are connected[/color]
to server1, session[color=blue]
>variables are saved - ON server1. Then you click a link,[/color]
go to the alias -[color=blue]
>and THIS time you go to server2. When it goes to process[/color]
your request, it[color=blue]
>can't - because it's not the server where your session[/color]
data exists... So,[color=blue]
>imho - it's just better to stay away from those and[/color]
adopt a system that runs[color=blue]
>on everything, and even runs when you get into a[/color]
scenario when you need[color=blue]
>highly-available servers...
>
>hth
>
>"Abhilash.k.m" <abhilashkm@indiatimes.com> wrote in[/color]
message[color=blue]
>news:0d7c01c36b53$aef58750$a001280a@phx.gbl...[color=green]
>> 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[/color][/color]
is[color=blue][color=green]
>> created out of them. The custom object is stored into[/color][/color]
the[color=blue][color=green]
>> session. Example: NameValueCollection is an object[/color][/color]
where[color=blue][color=green]
>> data will be stored as NameValueCollection["a"][/color][/color]
= "XYZ",[color=blue][color=green]
>> 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[/color][/color]
framework[color=blue][color=green]
>>
>>[/color]
>
>
>.
>[/color] | | | | re: ASP.NET session management using SQL SERVER
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" <abhilashkm@indiatimes.com> wrote in message
news:07c701c36b57$85255910$a101280a@phx.gbl...[color=blue]
> 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[color=green][color=darkred]
> >> 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[/color][/color]
> is[color=green][color=darkred]
> >> created out of them. The custom object is stored into[/color][/color]
> the[color=green][color=darkred]
> >> session. Example: NameValueCollection is an object[/color][/color]
> where[color=green][color=darkred]
> >> data will be stored as NameValueCollection["a"][/color][/color]
> = "XYZ",[color=green][color=darkred]
> >> NameValueCollection["b"]=100, NameValueCollection["c"]
> >> ="NAME". Finally while storing it in the session the
> >> NameValueCollection is used as Session["DATA"]=
> >> NameValueCollection.[/color][/color]
>
>[color=green]
> >-----Original Message-----
> >Some people would disagree, but for the past few years -[/color]
> I pretty much[color=green]
> >consider a SQL server an immediate part of my[/color]
> application. If you have a[color=green]
> >local, semi-robust SQL server - then making calls (like[/color]
> storing session[color=green]
> >information) is pretty negligable..
> >
> >So, I would say - you should have a SessionID - write[/color]
> that out as a cookie[color=green]
> >to the client.. then in a database, you have a SessionID[/color]
> that relates to[color=green]
> >whatever session data that you need...
> >
> >Same with traditional ASP - "Session" variables are[/color]
> really a bad idea. Even[color=green]
> >if you are not on a cluster/server farm now - at some[/color]
> point you will, and[color=green]
> >that is going to jam up your whole way of dealing with[/color]
> session data. The[color=green]
> >Session object stores things on the local server. So in[/color]
> a server farm[color=green]
> >scenario.. you go to the alias name, and are connected[/color]
> to server1, session[color=green]
> >variables are saved - ON server1. Then you click a link,[/color]
> go to the alias -[color=green]
> >and THIS time you go to server2. When it goes to process[/color]
> your request, it[color=green]
> >can't - because it's not the server where your session[/color]
> data exists... So,[color=green]
> >imho - it's just better to stay away from those and[/color]
> adopt a system that runs[color=green]
> >on everything, and even runs when you get into a[/color]
> scenario when you need[color=green]
> >highly-available servers...
> >
> >hth
> >
> >"Abhilash.k.m" <abhilashkm@indiatimes.com> wrote in[/color]
> message[color=green]
> >news:0d7c01c36b53$aef58750$a001280a@phx.gbl...[color=darkred]
> >> 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[/color][/color]
> is[color=green][color=darkred]
> >> created out of them. The custom object is stored into[/color][/color]
> the[color=green][color=darkred]
> >> session. Example: NameValueCollection is an object[/color][/color]
> where[color=green][color=darkred]
> >> data will be stored as NameValueCollection["a"][/color][/color]
> = "XYZ",[color=green][color=darkred]
> >> 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[/color][/color]
> framework[color=green][color=darkred]
> >>
> >>[/color]
> >
> >
> >.
> >[/color][/color] | | | | re: ASP.NET session management using SQL SERVER
I agree. I've had good luck even using DataTables and DataSets in Session
variables.
"Frank Drebin" <noemail@imsickofspam.com> wrote in message
news:cVx2b.33453$Vx2.14554464@newssvr28.news.prodi gy.com...[color=blue]
> In that case, I'd say a collection or an array would be ideal - because[/color]
you[color=blue]
> can easily iterate through the elements..
>
> "Abhilash.K.M" <abhilashkm@indiatimes.com> wrote in message
> news:07c701c36b57$85255910$a101280a@phx.gbl...[color=green]
> > 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[color=darkred]
> > >> 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[/color]
> > is[color=darkred]
> > >> created out of them. The custom object is stored into[/color]
> > the[color=darkred]
> > >> session. Example: NameValueCollection is an object[/color]
> > where[color=darkred]
> > >> data will be stored as NameValueCollection["a"][/color]
> > = "XYZ",[color=darkred]
> > >> NameValueCollection["b"]=100, NameValueCollection["c"]
> > >> ="NAME". Finally while storing it in the session the
> > >> NameValueCollection is used as Session["DATA"]=
> > >> NameValueCollection.[/color]
> >
> >[color=darkred]
> > >-----Original Message-----
> > >Some people would disagree, but for the past few years -[/color]
> > I pretty much[color=darkred]
> > >consider a SQL server an immediate part of my[/color]
> > application. If you have a[color=darkred]
> > >local, semi-robust SQL server - then making calls (like[/color]
> > storing session[color=darkred]
> > >information) is pretty negligable..
> > >
> > >So, I would say - you should have a SessionID - write[/color]
> > that out as a cookie[color=darkred]
> > >to the client.. then in a database, you have a SessionID[/color]
> > that relates to[color=darkred]
> > >whatever session data that you need...
> > >
> > >Same with traditional ASP - "Session" variables are[/color]
> > really a bad idea. Even[color=darkred]
> > >if you are not on a cluster/server farm now - at some[/color]
> > point you will, and[color=darkred]
> > >that is going to jam up your whole way of dealing with[/color]
> > session data. The[color=darkred]
> > >Session object stores things on the local server. So in[/color]
> > a server farm[color=darkred]
> > >scenario.. you go to the alias name, and are connected[/color]
> > to server1, session[color=darkred]
> > >variables are saved - ON server1. Then you click a link,[/color]
> > go to the alias -[color=darkred]
> > >and THIS time you go to server2. When it goes to process[/color]
> > your request, it[color=darkred]
> > >can't - because it's not the server where your session[/color]
> > data exists... So,[color=darkred]
> > >imho - it's just better to stay away from those and[/color]
> > adopt a system that runs[color=darkred]
> > >on everything, and even runs when you get into a[/color]
> > scenario when you need[color=darkred]
> > >highly-available servers...
> > >
> > >hth
> > >
> > >"Abhilash.k.m" <abhilashkm@indiatimes.com> wrote in[/color]
> > message[color=darkred]
> > >news:0d7c01c36b53$aef58750$a001280a@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[/color]
> > is[color=darkred]
> > >> created out of them. The custom object is stored into[/color]
> > the[color=darkred]
> > >> session. Example: NameValueCollection is an object[/color]
> > where[color=darkred]
> > >> data will be stored as NameValueCollection["a"][/color]
> > = "XYZ",[color=darkred]
> > >> 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[/color]
> > framework[color=darkred]
> > >>
> > >>
> > >
> > >
> > >.
> > >[/color][/color]
>
>[/color] | | | | re: ASP.NET session management using SQL SERVER
I agree. I've had good luck even using DataTables and DataSets in Session
variables.
"Frank Drebin" <noemail@imsickofspam.com> wrote in message
news:cVx2b.33453$Vx2.14554464@newssvr28.news.prodi gy.com...[color=blue]
> In that case, I'd say a collection or an array would be ideal - because[/color]
you[color=blue]
> can easily iterate through the elements..
>
> "Abhilash.K.M" <abhilashkm@indiatimes.com> wrote in message
> news:07c701c36b57$85255910$a101280a@phx.gbl...[color=green]
> > 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[color=darkred]
> > >> 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[/color]
> > is[color=darkred]
> > >> created out of them. The custom object is stored into[/color]
> > the[color=darkred]
> > >> session. Example: NameValueCollection is an object[/color]
> > where[color=darkred]
> > >> data will be stored as NameValueCollection["a"][/color]
> > = "XYZ",[color=darkred]
> > >> NameValueCollection["b"]=100, NameValueCollection["c"]
> > >> ="NAME". Finally while storing it in the session the
> > >> NameValueCollection is used as Session["DATA"]=
> > >> NameValueCollection.[/color]
> >
> >[color=darkred]
> > >-----Original Message-----
> > >Some people would disagree, but for the past few years -[/color]
> > I pretty much[color=darkred]
> > >consider a SQL server an immediate part of my[/color]
> > application. If you have a[color=darkred]
> > >local, semi-robust SQL server - then making calls (like[/color]
> > storing session[color=darkred]
> > >information) is pretty negligable..
> > >
> > >So, I would say - you should have a SessionID - write[/color]
> > that out as a cookie[color=darkred]
> > >to the client.. then in a database, you have a SessionID[/color]
> > that relates to[color=darkred]
> > >whatever session data that you need...
> > >
> > >Same with traditional ASP - "Session" variables are[/color]
> > really a bad idea. Even[color=darkred]
> > >if you are not on a cluster/server farm now - at some[/color]
> > point you will, and[color=darkred]
> > >that is going to jam up your whole way of dealing with[/color]
> > session data. The[color=darkred]
> > >Session object stores things on the local server. So in[/color]
> > a server farm[color=darkred]
> > >scenario.. you go to the alias name, and are connected[/color]
> > to server1, session[color=darkred]
> > >variables are saved - ON server1. Then you click a link,[/color]
> > go to the alias -[color=darkred]
> > >and THIS time you go to server2. When it goes to process[/color]
> > your request, it[color=darkred]
> > >can't - because it's not the server where your session[/color]
> > data exists... So,[color=darkred]
> > >imho - it's just better to stay away from those and[/color]
> > adopt a system that runs[color=darkred]
> > >on everything, and even runs when you get into a[/color]
> > scenario when you need[color=darkred]
> > >highly-available servers...
> > >
> > >hth
> > >
> > >"Abhilash.k.m" <abhilashkm@indiatimes.com> wrote in[/color]
> > message[color=darkred]
> > >news:0d7c01c36b53$aef58750$a001280a@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[/color]
> > is[color=darkred]
> > >> created out of them. The custom object is stored into[/color]
> > the[color=darkred]
> > >> session. Example: NameValueCollection is an object[/color]
> > where[color=darkred]
> > >> data will be stored as NameValueCollection["a"][/color]
> > = "XYZ",[color=darkred]
> > >> 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[/color]
> > framework[color=darkred]
> > >>
> > >>
> > >
> > >
> > >.
> > >[/color][/color]
>
>[/color] |  | | | | /bytes/about
We are a network of experts and professionals in IT and software development that help one another with answers to tough questions and share insights.
Get the best answers to your questions from over 226,471 network members.
|