Difference between a Postback and a Callback in ASP.NET

By | November 15, 2013
Share on FacebookShare on Google+Tweet about this on TwitterShare on LinkedInDigg thisShare on StumbleUponPin on Pinterest

A postback is a request sent from a client to server from the same page, user is already working with.

ASP.NET was introduced with a mechanism to post an HTTP POST request back to the same page. It’s basically posting a complete page back to server (i.e. sending all of its data) on same page. So, the whole page is refreshed.In order to understand how this postback mechanism works in ASP.NET, follow the simple steps:

  • Add a new ASP.NET web form page to a project e.g. WebForm1.aspx.
  • View the page code in HTML Source view. You will find something like following screen.PostBack Vs Callback
  • Look the form line of code.
    <form id=”form1″ runat=”server”>
    It represents a server-side implementation of form control.
  • Now just run the application to see WebForm1.aspx page and view its source code. HTML source of the page will display form element as follows:
    <form method=”post” action=”WebForm1.aspx” id=”form1″>

    You can see that an HTML form element generated with an HTTP method as “POST” and action=”WebForm1.aspx”. So, if a submit button is clicked, the page will postback to itself by default.Following figure will also give you more understanding on ASP.NET Postback.Understanding Postback in ASP.NETMore on IsPostBack property here.

Series of ASP.NET Interview Questions and Answers

A callback is generally a call for execution of a function after another function has completed.”

Understanding CallbackBut if we try to differentiate it from a postback then we can say: It’s a call made to the server to receive specific data instead of whole page refresh like a postback. In ASP.NET, its achieved using AJAX, that makes a call to server and updating a part of the page with specific data received.

Exam 70-486

Top 10 Interview Questions and Answers Series:

Share on FacebookShare on Google+Tweet about this on TwitterShare on LinkedInDigg thisShare on StumbleUponPin on Pinterest
Category: Ajax ASP.NET ASP.NET Web Forms Tags: ,


Imran Abdul Ghani is working as Software Developer(Senior) with extensive knowledge in Web development technologies especially C#, ASP.NET, MVC, WCF, Web API, ADO.NET Entity Framework, jQuery etc. He has several years of experience in designing/developing enterprise level applications. He is Microsoft Certified Solution Developer for .NET (MCSD.NET) since 2005. You can reach his blogging at www.webdevelopmenthelp.net, www.topwcftutorials.net, and www.sharepointfordummies.net.

  • good way to understand….

  • Great article.. keep blogging…

  • super rocking

  • anuj kr singh

    right lines for getting the actual means.