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

Page_Load serialized?

We have a problem in our application: if a user clicks a link to load
another page before the previous ASPX has finished executing, the Sub
New() constructor of the second page executes immediately, but its
Page_Load() event is not fired until the previous ASPX has finished.
I've reproduce this outside our applciation using two almost identical
pages Test1.aspx and Test2.aspx as follows:

----------------------------------------------------------

<%@ Page Language="vb" AutoEventWireup="false"
Codebehind="Test1.aspx.vb" Debug="False" Trace="False"
Inherits="UserInterface.Web.CTest1" %>

<html>
<head></head>
<body>

<h1>Test1</h1>

Before ... <%Snooze()%> After

</body>
</html>

----------------------------------------------------------

Public Class CTest1

Inherits System.Web.UI.Page

Public Sub New()
System.Diagnostics.Debug.WriteLine("Test1 New")
End Sub

Public Overridable Sub Page_Load(ByVal sender As System.Object,
ByVal e As System.EventArgs) Handles MyBase.Load
System.Diagnostics.Debug.WriteLine("Test1 Page_Load")
end sub

Public Sub Snooze()
System.Diagnostics.Debug.WriteLine("Test1 Snooze --->")
System.Threading.Thread.Sleep(10000)
System.Diagnostics.Debug.WriteLine("Test1 Snooze <---")
End Sub

End Class

Nov 19 '05 #1
5 1044
Have you tried it using some other way of implementing Snooze? I'm not
sure, but I think you might be putting the entire asp_wp process to
sleep, which would stop your second page (and the whole of asp.net)
from running.

Nov 19 '05 #2

Phillip Ian wrote:
Have you tried it using some other way of implementing Snooze? I'm not
We don't call Sleep() in our application; we have a slow database
query.
sure, but I think you might be putting the entire asp_wp process to
sleep, which would stop your second page (and the whole of asp.net)
from running.


Other sessions are not affected.

Nov 19 '05 #3
Right, sleep only pauses the current request.

Page_Load is not serialized, but concurrent requests to a specific
instance of Session state are serialized - if those requests intend to
change Session state.

You can set EnableSessionState="false" in the @ Page directive to
avoid the serialization. EnableSessionState="ReadOnly" will also
change the behavior you see, because the runtime uses a reader /
writer lock, and multiple readers are allowed in.

HTH,

--
Scott
http://www.OdeToCode.com/blogs/scott/


On 1 Aug 2005 06:06:40 -0700, aj*****@hotmail.com wrote:

Phillip Ian wrote:
Have you tried it using some other way of implementing Snooze? I'm not


We don't call Sleep() in our application; we have a slow database
query.
sure, but I think you might be putting the entire asp_wp process to
sleep, which would stop your second page (and the whole of asp.net)
from running.


Other sessions are not affected.


Nov 19 '05 #4

aj*****@hotmail.com wrote:
We have a problem in our application: if a user clicks a link to load
another page before the previous ASPX has finished executing, the Sub
New() constructor of the second page executes immediately, but its
Page_Load() event is not fired until the previous ASPX has finished.


http://msdn2.microsoft.com/library/m...us,vs.80).aspx

says:

Concurrent Requests and Session State
Access to ASP.NET session state is exclusive per session. That is, if
two different users make concurrent requests, then access to each
separate session is granted concurrently. However, if two concurrent
requests are made for the same session (that is, using the same
System.Web.SessionState.HttpSessionState.SessionID value), then the
first request received gains exclusive access to the session
information and the second request will execute once the first request
completes. If the
System.Web.Configuration.PagesSection.EnableSessio nState page directive
is set to ReadOnly, then a request for the read-only session
information does not result in an exclusive lock of the session data.
Read-only requests for session data may still have to wait for a lock
gained by a read-write request for session data to clear.

Nov 19 '05 #5
This is true in ASP.NET 1.x also.

--
Scott
http://www.OdeToCode.com/blogs/scott/

On 1 Aug 2005 06:36:54 -0700, aj*****@hotmail.com wrote:

aj*****@hotmail.com wrote:
We have a problem in our application: if a user clicks a link to load
another page before the previous ASPX has finished executing, the Sub
New() constructor of the second page executes immediately, but its
Page_Load() event is not fired until the previous ASPX has finished.


http://msdn2.microsoft.com/library/m...us,vs.80).aspx

says:

Concurrent Requests and Session State
Access to ASP.NET session state is exclusive per session. That is, if
two different users make concurrent requests, then access to each
separate session is granted concurrently. However, if two concurrent
requests are made for the same session (that is, using the same
System.Web.SessionState.HttpSessionState.SessionI D value), then the
first request received gains exclusive access to the session
information and the second request will execute once the first request
completes. If the
System.Web.Configuration.PagesSection.EnableSessi onState page directive
is set to ReadOnly, then a request for the read-only session
information does not result in an exclusive lock of the session data.
Read-only requests for session data may still have to wait for a lock
gained by a read-write request for session data to clear.


Nov 19 '05 #6

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

Similar topics

0
by: Ray Mitchell | last post by:
Hello, The result of auto-converting some Java code to C# yielded the following upgrade issue regarding the original Java call to "reset()": public virtual void writeObj(Object obj) {...
0
by: Wim Hollebrandse | last post by:
Here's the scenario. I'm serializing a particular object, which contains other objects as properties. I have this particular enum type that won't get included in the serialized XML. For...
0
by: Pierre | last post by:
Hi, I'm trying to select specific nodes from a XmlDocument filled with a serialized object and to insert these nodes into another XmlDocument. The object is well serialized (see below). From a...
7
by: Neal Andrews | last post by:
Hi All, Does anyone know how to stop Events from being serialized in a class that uses the <Serializable()> attribute? I have tried using the <NonSerialized()> attribute but for some bizarre...
2
by: Dennis C. Drumm | last post by:
Is there a way to open files with .net 1.1 versions of my software product that were serialized with a .net 2.0 version of same product? Right now, as soon as my older .net 1.1 application tries to...
5
by: EqDev | last post by:
I have a class that is a control derived from UserControl. I want to use serialization and deserialization with this calss but I get an exception "Cannot serialize member...
1
by: Phil Galey | last post by:
I'm using XMLSerializer in VB.NET to serialize class-based objects to XML. It's serializing fine, except that I don't seem to have control over the order in which the various fields (properties) of...
0
by: bharathreddy | last post by:
Before going to that i want to say few thing on serialization : Serialization is the process of converting an object into a form that can be readily transported. For example, you can serialize an...
9
by: PI | last post by:
Hi Guys, I need some assistance with the following scenario please. I know this might be more of a MySQL post than a PHP one, but it is likely some developer has been here before and would be...
1
by: CloudSolutions | last post by:
Introduction: For many beginners and individual users, requiring a credit card and email registration may pose a barrier when starting to use cloud servers. However, some cloud server providers now...
0
isladogs
by: isladogs | last post by:
The next Access Europe User Group meeting will be on Wednesday 3 Apr 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 former...
0
by: ryjfgjl | last post by:
In our work, we often need to import Excel data into databases (such as MySQL, SQL Server, Oracle) for data analysis and processing. Usually, we use database tools like Navicat or the Excel import...
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...
1
by: Sonnysonu | last post by:
This is the data of csv file 1 2 3 1 2 3 1 2 3 1 2 3 2 3 2 3 3 the lengths should be different i have to store the data by column-wise with in the specific length. suppose the i have to...

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.