473,763 Members | 8,423 Online
Bytes | Software Development & Data Engineering Community
+ Post

Home Posts Topics Members FAQ

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 2225
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%3Dse ssion%2B%2Bstev en%2Bchen
g%26hl%3Den%26l r%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.m icrosoft.com> wrote in message
news:oo******** ******@cpmsftng xa06.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%3Dse ssion%2B%2Bstev en%2Bchen g%26hl%3Den%26l r%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
1585
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: http://www.dwayneepps.com/abr_site/fundingrequest.asp If you click on the "New Transaction" button it will generate a new row for the user to input information. I call a javascript function when the user clicks the "New Transaction" button that redirects to another page that...
1
1698
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 interesting thing is when I open a email with the DB attached (on the ME computer), the file is not "enabled" in the file list, it's grey. First time I see this.
1
737
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 find one? Thanks Werner P.S. Somehow I did not manage to do a followup in Googles newsgroups.
5
2200
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 me to toss my assemblies into. We keep loosing session state every few months. People have told me that my app could be running out of memory, causing the sessions to get reset. Well, if this is the case, then when I go to the page again,...
67
2951
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 the IIS directory gets created right away, but it is not configured as an application directory until several minutes go by. Thanks, Scott M.
0
1026
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 virtual directory and then given the check for the integrated window authetication. After deploying the project in the testing server - windows 2003 server (server called as svr10) it is working fine.
2
2431
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..... Thanks PAGE 1 - test.aspx <%@ Page Language="VB" %>
2
2644
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 yet expired) to log in. That way if someone sticks a made-up session ID on a URL, it won't matter, unless it happens to correspond to an active session (guessing a user password is probably easier). Is this already standard practice, new, or is...
11
3658
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 method has the WebMethodAttribute.EnableSession set to true. When I run the test page the session is maintained. However, using a console application, in between setting the string value and attempting to
0
10002
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 tapestry of website design and digital marketing. It's not merely about having a website; it's about crafting an immersive digital experience that captivates audiences and drives business growth. The Art of Business Website Design Your website is...
0
9823
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 protocol has its own unique characteristics and advantages, but as a user who is planning to build a smart home system, I am a bit confused by the choice of these technologies. I'm particularly interested in Zigbee because I've heard it does some...
0
8822
agi2029
by: agi2029 | last post by:
Let's talk about the concept of autonomous AI software engineers and no-code agents. These AIs are designed to manage the entire lifecycle of a software development project—planning, coding, testing, and deployment—without human intervention. Imagine an AI that can take a project description, break it down, write the code, debug it, and then launch it, all on its own.... Now, this would greatly impact the work of software developers. The idea...
1
7368
isladogs
by: isladogs | last post by:
The next Access Europe User Group meeting will be on Wednesday 1 May 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 a new presenter, Adolph Dupré who will be discussing some powerful techniques for using class modules. He will explain when you may want to use classes instead of User Defined Types (UDT). For example, to manage the data in unbound forms. Adolph will...
0
6643
by: conductexam | last post by:
I have .net C# application in which I am extracting data from word file and save it in database particularly. To store word all data as it is I am converting the whole word file firstly in HTML and then checking html paragraph one by one. At the time of converting from word file to html my equations which are in the word document file was convert into image. Globals.ThisAddIn.Application.ActiveDocument.Select();...
0
5270
by: TSSRALBI | last post by:
Hello I'm a network technician in training and I need your help. I am currently learning how to create and manage the different types of VPNs and I have a question about LAN-to-LAN VPNs. The last exercise I practiced was to create a LAN-to-LAN VPN between two Pfsense firewalls, by using IPSEC protocols. I succeeded, with both firewalls in the same network. But I'm wondering if it's possible to do the same thing, with 2 Pfsense firewalls...
1
3917
by: 6302768590 | last post by:
Hai team i want code for transfer the data from one system to another through IP address by using C# our system has to for every 5mins then we have to update the data what the data is updated we have to send another system
2
3528
muto222
by: muto222 | last post by:
How can i add a mobile payment intergratation into php mysql website.
3
2794
bsmnconsultancy
by: bsmnconsultancy | last post by:
In today's digital era, a well-designed website is crucial for businesses looking to succeed. Whether you're a small business owner or a large corporation in Toronto, having a strong online presence can significantly impact your brand's success. BSMN Consultancy, a leader in Website Development in Toronto offers valuable insights into creating effective websites that not only look great but also perform exceptionally well. In this comprehensive...

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.