Click here to Skip to main content
12,892,015 members (52,064 online)
Click here to Skip to main content
Add your own
alternative version

Tagged as


3 bookmarked
Posted 2 Nov 2011

Asynchronous and Synchronous Page Processing Determination

, 6 Nov 2011 CPOL
Rate this:
Please Sign up or sign in to vote.
An easy way to understand Ajax help in ASP.NET
Using this simple trick, everyone can easily ensure that page processing is synchronous or asynchronous.
<asp:ScriptManager ID="ScriptManager1" runat="server" EnableHistory="true">
       <asp:UpdatePanel ID="UpdatePanel1" runat="server">
             <asp:Label ID="Label1" runat="server" Text="Label"></asp:Label>
             <asp:Label ID="Label2" runat="server" Text="Label"></asp:Label>
             <asp:Timer ID="Timer1" runat="server" Interval="40000" ontick="Timer1_Tick">
             <asp:Label ID="Label3" runat="server"></asp:Label>

Code Behind

protected void Page_Load(object sender, EventArgs e)
           if (ScriptManager1.IsInAsyncPostBack==true)
               Label1.Text = "Page processing is Ashnchronuslly..";
               Label1.Text = "Page Processing is Syncrhonulsy...";
       protected void Timer1_Tick(object sender, EventArgs e)
           if (ScriptManager1.IsInAsyncPostBack == true)
               Label2.Text = DateTime.Now.ToString();


For the First Request only Synchronous Processing is done.
                       Page Processing is Syncronously... Label
For the Second Request onwords
          Page Processing IS Asynchronously.. 11/1/2011 12:37:27 PM

Yes, for every 40 secs updatedpanel content is updated asynchronusly with the help of Timer Control Tick event, the updated time will be displayed in Lable2. We can ensure many things for every request and response internals with the help of any Firebug console window or any browsers WebDevelopment tools.

Like below for every 40 seconds:

POST http://localhost:1165/PageProces.aspx 200 OK 520ms	
POST http://localhost:1165/PageProces.aspx 200 OK 348ms	
POST http://localhost:1165/PageProces.aspx 200 OK 370ms	
POST http://localhost:1165/PageProces.aspx 200 OK 336ms	
POST http://localhost:1165/PageProces.aspx 200 OK 362ms	
POST http://localhost:1165/PageProces.aspx 200 OK 382ms	
POST http://localhost:1165/PageProces.aspx 200 OK 378ms	


This article, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)


About the Author

kas ibabu
India India
No Biography provided

You may also be interested in...


Comments and Discussions

-- There are no messages in this forum --
Permalink | Advertise | Privacy | Terms of Use | Mobile
Web02 | 2.8.170424.1 | Last Updated 6 Nov 2011
Article Copyright 2011 by kas ibabu
Everything else Copyright © CodeProject, 1999-2017
Layout: fixed | fluid