473,394 Members | 1,902 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,394 software developers and data experts.

How can I handle postback data after session timeout?

I have an ASP.Net 1.1 application using datagrid. I am trying to handle conditions where
the users post back an updated datagrid after the session times out. The results are not
pretty. Sometimes IE will report an invalid ViewState and sometimes my application will
generate a typical exception because the object reference has become null.

How does the experts and the rugged WEB applications handle or detect when the data
received from the browser is some left over from a previous session?
Nov 19 '05 #1
4 2689
There are alternatives when storing the Session data... this will of course
be a little tradeoff on the Performance but you have store the session
information in other places...

If possible and the page is not too big already, then why not save the dataa
whithin the viewstate of the page?

Or if you really need to store it on the server.. Read about storing Session
data in a SQL database or thru the ASP.NET State Service

/Lars

"Gaetan" <so*****@somewhere.com> wrote in message
news:kq********************************@4ax.com...
I have an ASP.Net 1.1 application using datagrid. I am trying to handle
conditions where
the users post back an updated datagrid after the session times out. The
results are not
pretty. Sometimes IE will report an invalid ViewState and sometimes my
application will
generate a typical exception because the object reference has become null.

How does the experts and the rugged WEB applications handle or detect when
the data
received from the browser is some left over from a previous session?

Nov 19 '05 #2
I guess I can always go the extra mile and save state data elsewhere. Nevertheless, I
still need to determine when the postback occurs after the session expired.

I noticed that on a Session_Start() event, the Request.HttpMethod property is set to
"GET". After that, when the user takes an action on the web page which causes a post back
to the server, the Request.HttpMethod property is then set to "POST".

After a session timeout, if the user once more cause a post back, the Session_Start()
event is fired and this tim Request.HttpMethod instead of being set to GET, is not set
to POST.

Would a check on "POST" in a Session_Start() event be enough to detect a post-session
timout request?
On Mon, 24 Oct 2005 12:02:49 +0200, "Lars Netzel" <ui****@adf.se> wrote:
There are alternatives when storing the Session data... this will of course
be a little tradeoff on the Performance but you have store the session
information in other places...

If possible and the page is not too big already, then why not save the dataa
whithin the viewstate of the page?

Or if you really need to store it on the server.. Read about storing Session
data in a SQL database or thru the ASP.NET State Service

/Lars

Nov 19 '05 #3
Gaetan, I see you beat me to this.

This problem happens even when there is no datagrid. For example. Simple
form with a couple TextBox controls. Browse to the page, data appears in the
Texboxes. Wait until the session times out, change data in the textboxes and
submit the data... InvalidViewState exception.
--

Steven Hughes - MCSD
"Gaetan" wrote:
I have an ASP.Net 1.1 application using datagrid. I am trying to handle conditions where
the users post back an updated datagrid after the session times out. The results are not
pretty. Sometimes IE will report an invalid ViewState and sometimes my application will
generate a typical exception because the object reference has become null.

How does the experts and the rugged WEB applications handle or detect when the data
received from the browser is some left over from a previous session?

Nov 19 '05 #4
the same thing happens on an application recycle. you should detect that
the session has been cleared and take corrective action.

the cheapest (not too profession, but better than crashing), to to redirect
to a recover page. this logic could be added to begin request in the global
application object.

-- bruce (sqlwork.com)

"Gaetan" <so*****@somewhere.com> wrote in message
news:kq********************************@4ax.com...
I have an ASP.Net 1.1 application using datagrid. I am trying to handle
conditions where
the users post back an updated datagrid after the session times out. The
results are not
pretty. Sometimes IE will report an invalid ViewState and sometimes my
application will
generate a typical exception because the object reference has become null.

How does the experts and the rugged WEB applications handle or detect when
the data
received from the browser is some left over from a previous session?

Nov 19 '05 #5

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

Similar topics

12
by: Edward Rothwell | last post by:
I have a web site where once a user has logged on I store their MemberID in a global variable in the global.asa file. Then in other pages I find out which member I am dealing with by looking at...
1
by: Rhys | last post by:
I have a page which has an IFrame on it. The src of the IFrame is a page with a datagrid on it. The Datagrid has bound template columns. The columns of the datagrid pass the bound data value of...
1
by: Earl Teigrob | last post by:
I did a ton of searching to try and find a simple solution to this issue and finally wrote my own, which I am sharing with everyone. In my searching, I did find a very complete and robust solution at...
3
by: kurt | last post by:
Hi All. I have a page that users enter information in text boxes...and sometimes it's a lot of information. There are times that these folks either take their time entering the info or do other...
0
by: ryjfgjl | last post by:
If we have dozens or hundreds of excel to import into the database, if we use the excel import function provided by database editors such as navicat, it will be extremely tedious and time-consuming...
0
by: ryjfgjl | last post by:
In our work, we often receive Excel tables with data in the same format. If we want to analyze these data, it can be difficult to analyze them because the data is spread across multiple Excel files...
0
BarryA
by: BarryA | last post by:
What are the essential steps and strategies outlined in the Data Structures and Algorithms (DSA) roadmap for aspiring data scientists? How can individuals effectively utilize this roadmap to progress...
1
by: nemocccc | last post by:
hello, everyone, I want to develop a software for my android phone for daily needs, any suggestions?
0
marktang
by: marktang | last post by:
ONU (Optical Network Unit) is one of the key components for providing high-speed Internet services. Its primary function is to act as an endpoint device located at the user's premises. However,...
0
by: Hystou | last post by:
Most computers default to English, but sometimes we require a different language, especially when relocating. Forgot to request a specific language before your computer shipped? No problem! You can...
0
jinu1996
by: jinu1996 | last post by:
In today's digital age, having a compelling online presence is paramount for businesses aiming to thrive in a competitive landscape. At the heart of this digital strategy lies an intricately woven...
0
by: Hystou | last post by:
Overview: Windows 11 and 10 have less user interface control over operating system update behaviour than previous versions of Windows. In Windows 11 and 10, there is no way to turn off the Windows...
0
tracyyun
by: tracyyun | last post by:
Dear forum friends, With the development of smart home technology, a variety of wireless communication protocols have appeared on the market, such as Zigbee, Z-Wave, Wi-Fi, Bluetooth, etc. Each...

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.