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

Repost: New Session Created on Post Back!

Tried to post this hours ago, but it still isn't visible. If it's a repeat,
sorry for the inconvenience.

Hello, all ---

Environment: Visual Studio.NET 2003 (C#); Windows 2003 Server; IIS 6.0

Here is the problem I am having. I have created a web custom control in C#
which includes a datagrid, label, and code to support populating and paging
the datagrid. The dataset which contains the data displayed in the datagrid
is stored in a session variable.

The control displays a list of people. This control is used in two pages in
an application. In one instance, it displays the results of a search by
the user in a directory. In the other case, it displays the list of people
working in a department on a page with information about the department.

In all cases where the control is used, a class with search criteria is
passed to a web service which queries a SQL Server 2000 database and returns
a dataset containing records which match the criteria. The dataset is then
stored in a session variable.

When returning the results of a user-defined search, it works perfectly.
When displaying on the page containing information about a department,
paging produces a significant problem. When the user clicks Next, the
datagrid does not display and other data on the page which is based on other
session variables is wrong. I ran the debugger and discovered that every
time the Next is clicked in the control from the department page, the
Session_Start event is fired. When the same control is used in the search
results page, the Session_Start event does not fire when the user clicks
Next, and the paging is flawless.

I have seen two basic solutions in different groups. One says that
something must be in a session variable or the session_start event must be
coded to keep a new session from being created. Session_Start is coded, and
data is placed in session variables before this problem arises, so neither
of these is the problem. The other thing I have seen discussed is a restart
of the ASP process. None of the conditions which should lead to such a
restart seem to apply here.

If any additional information is needed, please let me know. I am at a loss
to even be sure what additional information would be useful at this point.
Any help would be appreciated. Thank you.
Nov 18 '05 #1
2 2210
Hi Paul,

From your description, you've defined a custom control which will retrieve
some certain data from database and display to end user. Since the data may
contains many records(need paging ), you store them in Session Variables
for later use. However, you found when the user click the "next" button on
page to view the sequential data, the session will be timeout (a new
session started) and the session data lost, yes?

Based on my experience, there are some certain things which may cause the
Session be timeout(restart) in addition to the application(or asp.net
worker process) restart:
1. When there occurs unhandled exception in the web application, if we
haven't manually catch it , the current Session will ended and a new one
started.

2. When we use javascript function showModalDialog to show a ModalDialog
and open another page in this ModalDialog, this will cause the SessionId be
incorrect. Here is a former thread discussin on this problem:
http://groups.google.com/groups?hl=e...ZbbLZEHA.3120%
40cpmsftngxa06.phx.gbl&rnum=13&prev=/groups%3Fq%3Dsession%2B%2Bsteven%2Bchen
g%26hl%3Den%26lr%3D%26ie%3DUTF-8%26start%3D10%26sa%3DN

In addition, since you mentioned that it work well in one page and not work
in another, have you find any difference between the two page? It'll be
helpful it you can generate a simple page which can repro the hehavior so
that we can do some tests on our side. Thanks
Regards,

Steven Cheng
Microsoft Online Support

Get Secure! www.microsoft.com/security
(This posting is provided "AS IS", with no warranties, and confers no
rights.)

Get Preview at ASP.NET whidbey
http://msdn.microsoft.com/asp.net/whidbey/default.aspx
Nov 18 '05 #2
Thank you, Steven. Your reply put us on the right track and led us to a bug
in our code in a custom control used as a page header. We had not looked at
this before, since it was a common element for all pages whether they
exhibited the problem or not.
"Steven Cheng[MSFT]" <v-******@online.microsoft.com> wrote in message
news:oo**************@cpmsftngxa06.phx.gbl...
Hi Paul,

From your description, you've defined a custom control which will retrieve
some certain data from database and display to end user. Since the data may contains many records(need paging ), you store them in Session Variables
for later use. However, you found when the user click the "next" button on
page to view the sequential data, the session will be timeout (a new
session started) and the session data lost, yes?

Based on my experience, there are some certain things which may cause the
Session be timeout(restart) in addition to the application(or asp.net
worker process) restart:
1. When there occurs unhandled exception in the web application, if we
haven't manually catch it , the current Session will ended and a new one
started.

2. When we use javascript function showModalDialog to show a ModalDialog
and open another page in this ModalDialog, this will cause the SessionId be incorrect. Here is a former thread discussin on this problem:
http://groups.google.com/groups?hl=e...ZbbLZEHA.3120% 40cpmsftngxa06.phx.gbl&rnum=13&prev=/groups%3Fq%3Dsession%2B%2Bsteven%2Bchen g%26hl%3Den%26lr%3D%26ie%3DUTF-8%26start%3D10%26sa%3DN

In addition, since you mentioned that it work well in one page and not work in another, have you find any difference between the two page? It'll be
helpful it you can generate a simple page which can repro the hehavior so
that we can do some tests on our side. Thanks
Regards,

Steven Cheng
Microsoft Online Support

Get Secure! www.microsoft.com/security
(This posting is provided "AS IS", with no warranties, and confers no
rights.)

Get Preview at ASP.NET whidbey
http://msdn.microsoft.com/asp.net/whidbey/default.aspx

Nov 18 '05 #3

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

Similar topics

6
by: -D- | last post by:
I'm trying to accomplish the following. I'm trying to get the values for the table rows that are dynamically created to persist through a redirect. Referring URL:...
1
by: Yannick Turgeon | last post by:
Hello, This is a repost (see under the "dotted" line) from 2 days ago. Hope someone could help. Norton Antivirus 2003 is installed on this computer. Could it cause a problem? Another...
1
by: Werner | last post by:
Hi Patrick! Can you give an example of how to use a frameset inside an aspx-file? When I create a new frameset in Visual Studio.Net it just gives me a htm-File. Or give me a link where I can...
5
by: ASP.Confused | last post by:
As you can tell from my previous posts on this issue...I'm really confused :-/ I have a few ASP.NET web applications on my web host's "https" server. Our web host has a single "bin" folder for...
67
by: Scott M. | last post by:
Can anyone give me any ideas on why VS.NET 2003 running on XP Pro. (P4's with 1GB RAM) would take over 3 minutes to simply create a new ASP.NET Web Application on http://localhost? It seems that...
0
by: sasidar.d | last post by:
hi techies I have created a Login web page . It gets the user identity using the window nt authetication. The page is working fine. I have removed the allow anonymous access check box for the...
2
by: ShaneFowlkes | last post by:
I created a couple of quick test pages and to my surprise, these do not work either. When I click "Go Back" on test2.aspx, nothing happens. Ideas?? Surely I must be missing something obvious........
2
by: Gordon Burditt | last post by:
I had this idea about preventing session fixation, and I'm wondering what anyone else thinks about it. The idea is, essentially, don't allow session ids that YOUR PHP didn't generate (and aren't...
11
by: Glenn | last post by:
Hi I've been experimenting with managing state using the Session object. I've created a simple WS with a couple of methods, one which sets a string value, another that retrieves it. Each...
0
by: taylorcarr | last post by:
A Canon printer is a smart device known for being advanced, efficient, and reliable. It is designed for home, office, and hybrid workspace use and can also be used for a variety of purposes. However,...
0
by: Charles Arthur | last post by:
How do i turn on java script on a villaon, callus and itel keypad mobile phone
0
by: aa123db | last post by:
Variable and constants Use var or let for variables and const fror constants. Var foo ='bar'; Let foo ='bar';const baz ='bar'; Functions function $name$ ($parameters$) { } ...
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
by: emmanuelkatto | last post by:
Hi All, I am Emmanuel katto from Uganda. I want to ask what challenges you've faced while migrating a website to cloud. Please let me know. Thanks! Emmanuel
1
by: nemocccc | last post by:
hello, everyone, I want to develop a software for my android phone for daily needs, any suggestions?
0
by: Hystou | last post by:
There are some requirements for setting up RAID: 1. The motherboard and BIOS support RAID configuration. 2. The motherboard has 2 or more available SATA protocol SSD/HDD slots (including MSATA, M.2...
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,...

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.