New Session Created on Post Back!

G

Guest

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.
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Members online

No members online now.

Forum statistics

Threads
473,744
Messages
2,569,484
Members
44,904
Latest member
HealthyVisionsCBDPrice

Latest Threads

Top