473,326 Members | 2,010 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.

session advice

ari
hey all,

i'm trying to make my app as stateless as possible. is it ok to create a
dataset and store in viewstate and whenever the user decides to select a from
that dataset, to move from viewstate, to session, and on the details page
back to viewstate. Or does that sound like too much work?

thanks,
ari
Nov 19 '05 #1
8 1722
sort of stateless isn't stateless at all.

Why bother moving things in and out of session?
You'd still have to have session enabled and
be subject to its limitations (especially in
a web farm).

--
2004 and 2005 Microsoft MVP C#
Robbe Morris
http://www.masterado.net

Earn $$$ money answering .NET Framework
messageboard posts at EggHeadCafe.com.
http://www.eggheadcafe.com/forums/merit.asp

"ari" <ar*@discussions.microsoft.com> wrote in message
news:38**********************************@microsof t.com...
hey all,

i'm trying to make my app as stateless as possible. is it ok to create a
dataset and store in viewstate and whenever the user decides to select a
from
that dataset, to move from viewstate, to session, and on the details page
back to viewstate. Or does that sound like too much work?

thanks,
ari

Nov 19 '05 #2
ari
Do you have any reference material (good articles) where I can correctly
accomplish this. As you can see I'm very new.

"Robbe Morris [C# MVP]" wrote:
sort of stateless isn't stateless at all.

Why bother moving things in and out of session?
You'd still have to have session enabled and
be subject to its limitations (especially in
a web farm).

--
2004 and 2005 Microsoft MVP C#
Robbe Morris
http://www.masterado.net

Earn $$$ money answering .NET Framework
messageboard posts at EggHeadCafe.com.
http://www.eggheadcafe.com/forums/merit.asp

"ari" <ar*@discussions.microsoft.com> wrote in message
news:38**********************************@microsof t.com...
hey all,

i'm trying to make my app as stateless as possible. is it ok to create a
dataset and store in viewstate and whenever the user decides to select a
from
that dataset, to move from viewstate, to session, and on the details page
back to viewstate. Or does that sound like too much work?

thanks,
ari


Nov 19 '05 #3
Sessions seem to be a mystery and very easy to break.

ari wrote:
Do you have any reference material (good articles) where I can correctly
accomplish this. As you can see I'm very new.

"Robbe Morris [C# MVP]" wrote:

sort of stateless isn't stateless at all.

Why bother moving things in and out of session?
You'd still have to have session enabled and
be subject to its limitations (especially in
a web farm).

--
2004 and 2005 Microsoft MVP C#
Robbe Morris
http://www.masterado.net

Earn $$$ money answering .NET Framework
messageboard posts at EggHeadCafe.com.
http://www.eggheadcafe.com/forums/merit.asp

"ari" <ar*@discussions.microsoft.com> wrote in message
news:38**********************************@micros oft.com...
hey all,

i'm trying to make my app as stateless as possible. is it ok to create a
dataset and store in viewstate and whenever the user decides to select a
from
that dataset, to move from viewstate, to session, and on the details page
back to viewstate. Or does that sound like too much work?

thanks,
ari


Nov 19 '05 #4
> Sessions seem to be a mystery and very easy to break.

A mystery is only a mystery until it is understood. There is nothing really
mysterious about Session at all. Perhaps I can clear up the mystery for you.

ASP.Net runs in the context of HTTP messaging, generally between a browser
client and a web server. HTTP is stateless. This means that there is no
state between requests. The server receives a request for a resource (an
ASP.Net page), processes the request, and sends the response. It immediately
forgets everything it has just done. The browser loads one HTML document
into memory at a time, and forgets the last document that was loaded upon
reloading. The only memory on the browser side is the history of the URLs it
has visited, the cached documents it stores on the machine, and text
cookies, which are stored by domain.

ASP.net is an ISAPI (Internet Server Application Programming Interface)
application that runs on the web server. An application has memory for the
lifetime of the application. This is very important. The ASP.net application
is started with the first request for an ASP.Net page in that application,
and lives until either the application is restarted, or until 20 minutes (by
default) after the last request it receives. So, for this length of time, a
memory space exists on the server in which an individual ASP.Net application
can store and retrieve data. Hence, ASP.Net has an Application collection
and an Application cache that can be used to store Application-wide scoped
data.

When a Request for a resource is recieved on the server, the browser sends
headers with the Request. These headers contain helpful information for the
server, including the IP address (the "return address") of the client that
made the Request, as well as any Cookies that the browser may hold for that
domain or application. So, the ASP.Net ISAPI has event handlers that fire,
for example, the first time it receives a request from a browser it doesn't
have a Session yet for. If the browser doesn't send a Session Cookie, the
ASP.net ISAPI creates a memory cache called "Session" that belongs to that
client browser. It also sends a Session Cookie ("Session Cookie" is a term
that means a Cookie that is not stored in the file system of the client
machine, but lasts for the time that the browser is requesting documents
from the same domain) to the browser. The Session Cookie is a unique
identifier that identifies which server Session belongs to that client.

By this mechanism, the ASP.Net application creates its own form of
Session-specific state, a memory space that can be used across separate Page
Requests, and lasts for the lifetime of the client Session.

Now, how does the ASP.Net ISAPI know when the Session has ended? This is a
good question, since every Request happens "in a vacuum." The browser has no
way of knowing which page the user browses to will be the last page visited.
It can't tell the server therefore. So, the Session has a timer, which by
default is set to 20 minutes. Every time the browser sends another Request,
the timer is reset to 0. If it reaches 20 minutes, the Session memory for
that client is cleared up, ending the Session on the server.

--
HTH,

Kevin Spencer
Microsoft MVP
..Net Developer
Ambiguity has a certain quality to it.
"No One" <ai*******@blahblahblah.com> wrote in message
news:6e************@gandalf.grey-net.com...
Sessions seem to be a mystery and very easy to break.

ari wrote:
Do you have any reference material (good articles) where I can correctly
accomplish this. As you can see I'm very new.

"Robbe Morris [C# MVP]" wrote:

sort of stateless isn't stateless at all.

Why bother moving things in and out of session?
You'd still have to have session enabled and
be subject to its limitations (especially in
a web farm).

--
2004 and 2005 Microsoft MVP C#
Robbe Morris
http://www.masterado.net

Earn $$$ money answering .NET Framework
messageboard posts at EggHeadCafe.com.
http://www.eggheadcafe.com/forums/merit.asp

"ari" <ar*@discussions.microsoft.com> wrote in message
news:38**********************************@micro soft.com...

hey all,

i'm trying to make my app as stateless as possible. is it ok to create a
dataset and store in viewstate and whenever the user decides to select a
from
that dataset, to move from viewstate, to session, and on the details
page
back to viewstate. Or does that sound like too much work?

thanks,
ari

Nov 19 '05 #5
ari
how would a stateless environment handle the following scenario:
the user enters in search criteria,
the user is presented with a datagrid of records,
the user selects page 10 and selects a record,
after the user views/modify the record closes the record.

how do you return the user back to page 10 with
the same datagrid of records?

thanks,
ari
"Robbe Morris [C# MVP]" wrote:
sort of stateless isn't stateless at all.

Why bother moving things in and out of session?
You'd still have to have session enabled and
be subject to its limitations (especially in
a web farm).

--
2004 and 2005 Microsoft MVP C#
Robbe Morris
http://www.masterado.net

Earn $$$ money answering .NET Framework
messageboard posts at EggHeadCafe.com.
http://www.eggheadcafe.com/forums/merit.asp

"ari" <ar*@discussions.microsoft.com> wrote in message
news:38**********************************@microsof t.com...
hey all,

i'm trying to make my app as stateless as possible. is it ok to create a
dataset and store in viewstate and whenever the user decides to select a
from
that dataset, to move from viewstate, to session, and on the details page
back to viewstate. Or does that sound like too much work?

thanks,
ari


Nov 19 '05 #6
Then why does Win2003 Server and IIS 6 suddenly recycle Sessions,
invalidate view state and totally screw up my application? It didn't do
this before. Some service pack seems to have broken it. Reporting
Services is even hosed, even after an uninstall/reinstall round. And,
of course, the client is all pissed as hell.

Kevin Spencer wrote:
Sessions seem to be a mystery and very easy to break.

A mystery is only a mystery until it is understood. There is nothing really
mysterious about Session at all. Perhaps I can clear up the mystery for you.

ASP.Net runs in the context of HTTP messaging, generally between a browser
client and a web server. HTTP is stateless. This means that there is no
state between requests. The server receives a request for a resource (an
ASP.Net page), processes the request, and sends the response. It immediately
forgets everything it has just done. The browser loads one HTML document
into memory at a time, and forgets the last document that was loaded upon
reloading. The only memory on the browser side is the history of the URLs it
has visited, the cached documents it stores on the machine, and text
cookies, which are stored by domain.

ASP.net is an ISAPI (Internet Server Application Programming Interface)
application that runs on the web server. An application has memory for the
lifetime of the application. This is very important. The ASP.net application
is started with the first request for an ASP.Net page in that application,
and lives until either the application is restarted, or until 20 minutes (by
default) after the last request it receives. So, for this length of time, a
memory space exists on the server in which an individual ASP.Net application
can store and retrieve data. Hence, ASP.Net has an Application collection
and an Application cache that can be used to store Application-wide scoped
data.

When a Request for a resource is recieved on the server, the browser sends
headers with the Request. These headers contain helpful information for the
server, including the IP address (the "return address") of the client that
made the Request, as well as any Cookies that the browser may hold for that
domain or application. So, the ASP.Net ISAPI has event handlers that fire,
for example, the first time it receives a request from a browser it doesn't
have a Session yet for. If the browser doesn't send a Session Cookie, the
ASP.net ISAPI creates a memory cache called "Session" that belongs to that
client browser. It also sends a Session Cookie ("Session Cookie" is a term
that means a Cookie that is not stored in the file system of the client
machine, but lasts for the time that the browser is requesting documents
from the same domain) to the browser. The Session Cookie is a unique
identifier that identifies which server Session belongs to that client.

By this mechanism, the ASP.Net application creates its own form of
Session-specific state, a memory space that can be used across separate Page
Requests, and lasts for the lifetime of the client Session.

Now, how does the ASP.Net ISAPI know when the Session has ended? This is a
good question, since every Request happens "in a vacuum." The browser has no
way of knowing which page the user browses to will be the last page visited.
It can't tell the server therefore. So, the Session has a timer, which by
default is set to 20 minutes. Every time the browser sends another Request,
the timer is reset to 0. If it reaches 20 minutes, the Session memory for
that client is cleared up, ending the Session on the server.

Nov 19 '05 #7
dt
ari wrote:
how would a stateless environment handle the following scenario: the user enters in search criteria,
the user is presented with a datagrid of records,
the user selects page 10 and selects a record,
after the user views/modify the record closes the record.

how do you return the user back to page 10 with
the same datagrid of records?


ari,

An algorithm must exist that will get results 90 through 100. so if by
modify, you mean delete, you have a case where the records on page 10
can never be the same. However, the ASP.NET applicaiton can store the
state between requests in the session so that you can write your
application to remember what datagrid a client was looking at and which
page it was. That page will go get the records 90 through 100-- which
ever records that happens to be. This is a common problem, so Microsoft
made ASP.NET pretty much take care of that for the developer.

-dt
Nov 19 '05 #8
The view state issue surprises me. As long as
your machine key is valid across the farm, you should
be in good shape.

In Windows 2003 Server IIS 6, your app is being recycled
periodically. InProc session runs "in process". If you want
to avoid this altogether, you'll need to implement StateServer
on your local server or go with SQL Server Session State
management.

Read more:

http://www.eggheadcafe.com/articles/20021016.asp

--
2004 and 2005 Microsoft MVP C#
Robbe Morris
http://www.masterado.net

Earn $$$ money answering .NET Framework
messageboard posts at EggHeadCafe.com.
http://www.eggheadcafe.com/forums/merit.asp

"No One" <ai*******@blahblahblah.com> wrote in message
news:pe************@gandalf.grey-net.com...
Then why does Win2003 Server and IIS 6 suddenly recycle Sessions,
invalidate view state and totally screw up my application? It didn't do
this before. Some service pack seems to have broken it. Reporting
Services is even hosed, even after an uninstall/reinstall round. And, of
course, the client is all pissed as hell.

Kevin Spencer wrote:
Sessions seem to be a mystery and very easy to break.

A mystery is only a mystery until it is understood. There is nothing
really mysterious about Session at all. Perhaps I can clear up the
mystery for you.

ASP.Net runs in the context of HTTP messaging, generally between a
browser client and a web server. HTTP is stateless. This means that there
is no state between requests. The server receives a request for a
resource (an ASP.Net page), processes the request, and sends the
response. It immediately forgets everything it has just done. The browser
loads one HTML document into memory at a time, and forgets the last
document that was loaded upon reloading. The only memory on the browser
side is the history of the URLs it has visited, the cached documents it
stores on the machine, and text cookies, which are stored by domain.

ASP.net is an ISAPI (Internet Server Application Programming Interface)
application that runs on the web server. An application has memory for
the lifetime of the application. This is very important. The ASP.net
application is started with the first request for an ASP.Net page in that
application, and lives until either the application is restarted, or
until 20 minutes (by default) after the last request it receives. So, for
this length of time, a memory space exists on the server in which an
individual ASP.Net application can store and retrieve data. Hence,
ASP.Net has an Application collection and an Application cache that can
be used to store Application-wide scoped data.

When a Request for a resource is recieved on the server, the browser
sends headers with the Request. These headers contain helpful information
for the server, including the IP address (the "return address") of the
client that made the Request, as well as any Cookies that the browser may
hold for that domain or application. So, the ASP.Net ISAPI has event
handlers that fire, for example, the first time it receives a request
from a browser it doesn't have a Session yet for. If the browser doesn't
send a Session Cookie, the ASP.net ISAPI creates a memory cache called
"Session" that belongs to that client browser. It also sends a Session
Cookie ("Session Cookie" is a term that means a Cookie that is not stored
in the file system of the client machine, but lasts for the time that the
browser is requesting documents from the same domain) to the browser. The
Session Cookie is a unique identifier that identifies which server
Session belongs to that client.

By this mechanism, the ASP.Net application creates its own form of
Session-specific state, a memory space that can be used across separate
Page Requests, and lasts for the lifetime of the client Session.

Now, how does the ASP.Net ISAPI know when the Session has ended? This is
a good question, since every Request happens "in a vacuum." The browser
has no way of knowing which page the user browses to will be the last
page visited. It can't tell the server therefore. So, the Session has a
timer, which by default is set to 20 minutes. Every time the browser
sends another Request, the timer is reset to 0. If it reaches 20 minutes,
the Session memory for that client is cleared up, ending the Session on
the server.

Nov 19 '05 #9

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

Similar topics

2
by: Shyam | last post by:
Hi, I wanted some advice on the following. All the users who log in to the system are created in the SQL Server. As I am not keen to store any user information on the web.config file for...
5
by: Marc Rivait | last post by:
Here is a very interesting scenario. I have a simple test application that loads a page and sets a session variable on the load event. On the first page there is a link to a second page. The...
4
by: Elliot M. Rodriguez | last post by:
I am seeking some advice on an issue I am facing concerning session state. I have an app that relies on 2 session values being set at the start. These session values set the stage for data that...
1
by: DavidS | last post by:
I'm losing session state variables during my debug session. Basically, I've expanded on web development - worked with web site for about 4 months now without problems. I'm adding code to web pages...
4
by: Igor K | last post by:
Hi all, I'm developing asp.net website. Most of the pages are aspx, but let's say, some 10% are html. For this html pages i use httphandlers to intercept calls and to perform some job on this...
1
by: Larry Neylon | last post by:
Hi, I'm working on a VBScript application on IIS6 and I'm looking for some advice about the best way of replacing or improving session variable usage. The application is in a secure extranet...
0
by: joseph conrad | last post by:
Hi, I tried to implement my own session handler in order to keep control on the process the drawback I foun it is not creating and storing in my cookie the PHPSESSID variable anymore. reading te...
5
by: Terry On Windigo | last post by:
I think I have figured out my problem but I don't know how to solve it. We are going to start using a forums package and do not want our users to have to login to both our site, and then again to...
43
by: davidkoree | last post by:
I mean not about cookie. Does it have something to do with operating system or browser plugin? I appreciate any help.
1
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: Vimpel783 | last post by:
Hello! Guys, I found this code on the Internet, but I need to modify it a little. It works well, the problem is this: Data is sent from only one cell, in this case B5, but it is necessary that data...
0
by: jfyes | last post by:
As a hardware engineer, after seeing that CEIWEI recently released a new tool for Modbus RTU Over TCP/UDP filtering and monitoring, I actively went to its official website to take a look. It turned...
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: 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: 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.