New Session Created on Post Back!

  • Thread starter Thread starter Paul
  • Start date Start date
P

Paul

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.

Since this came up on another recent thread with a similar problem, let me
note that there are no underscores in any server names in my case.

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.
 
Hi Paul,

I reviewed the thread and find that one of my colleagues has replied to you
in the newsgroup below.
Newsgroups: microsoft.public.dotnet.framework.aspnet

You may go and take a look.

Best regards,

Peter Huang
Microsoft Online Partner Support

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