PDA

View Full Version : فرق postback و callback



ayani2002
پنج شنبه 24 اردیبهشت 1388, 01:08 صبح
با سلام

من میخواستم بدونم postback و callback چه فرقی دارند و از هر یک چه موقع باید استفاده کرد؟؟

Chabok
پنج شنبه 24 اردیبهشت 1388, 03:26 صبح
A Postback occurs when the data (the whole page) on the page is posted from the client to the server..ie the data is posted-back to the server, and thus the page is refreshed (redrawn)...think of it as 'sending the server the whole page (asp.net) full of data'.
On the other hand, a callback is also a special kind of postback, but it is just a quick round-trip to the server to get a small set of data (normally), and thus the page is not refreshed, unlike with the postback...think of it as 'calling the server, and receiving some data back'

http://stackoverflow.com/questions/365100/difference-between-a-postback-and-a-callback/365106


CallBack is One of the new features in ASP.Net 2.0 is the ability to call server-side code from client-side code. While this isn't something new, a new simpler and cleaner mechanism is now available: client callback. The general idea is to have some type of hook, client-side functions (Javascript) can use to utilize powerful server-side functions. A key benefit to this closing the gap on desktop applications with respect to cleaner, richer and more responsive applications.

PostBack is an action taken by an interactive webpage, when the entire page and its contents are sent back to the server for processing.


More
ASP.NET 2.0's Client Callback Feature (http://dotnetjunkies.com/Article/E80EC96F-1C32-4855-85AE-9E30EECF13D7.dcik)
How postback works in ASP.NET (http://www.xefteri.com/articles/show.cfm?id=18)

****************************************
ترجمه سریع :
پست بک هنگامی اتفاق می افتد که اطلاعات صفحه توسط کلاینت به سرور برای پردازش ارسال می شود و در پاسخ نیازمند ارسال کامل از سمت سرور به کلاینت است .(رفرش شدن صفحه)
مانند کلیک کردن یک کلید Submit در یک فرم وب

ولی کال بک امکان جدیدی در دات نت است که در واقع نوع دیگری از پست بک است.
به این صورت که درخواست مشخص و اصولاً کوچکی از سمت کلاینت به سرور ارسال می شود (با استفاده از موتور AJAX) و در سمت سرور پاسخ آن تولید شده و به کلاینت باز می گردد (بدون رفرش شدن صفحه) و توسط کدهای سمت کلاینت پاسخ سمت سرور بازیابی شده و عمل مورد نظر را انجام میدهد .

و چون این پست بک توسط موتور اصلی Ajax یعنی XMLHttpRequest انجام می شود (و توسط موتور اصلی مرورگر که همان صفحه جاریست انجام نمی شود) صفحه شما رفرش نخواهد شد .

موفق باشید / خدانگهدار