Execute server code without full postback

When the user clicks the button, I need to create a .bmp file on the server. After creating the .bmp file, I upload it to the html page. Would Ajax be the best way to do this?

+3
source share
6 answers

Yes AJAX is the best way. This can be done through the ASP.NET AJAX mechanisms , jQuery itself or another of your choice.

If you just create an image to return to the browser, instead of calling the ASP.NET page life cycle (.aspx) instead, use a lighter HTTP handler (.ashx). Here is a server side example .

(HTTP handlers work by inheriting your class from something like DefaultHttpHandler or by implementing IHttpHandler instead of the Page class.

Additional Samples and AJAX Communications Notes:

, HTTP Monitoring, ​​ Fiddler, HTTP- .

+4

: .

ajax - . jquery . - . , , .

http://docs.jquery.com/Main_Page

jQuery ajax documentation.

http://api.jquery.com/category/ajax/

jQuery, , , .

+2

. BMP , HTML?

BMP , Serer, , JPG . , AJAX .

, AJAX - , ( ), .

, Fiddler, Firefox Firebug, -.

+1

, .

0

, Ajax, , postback

0

You do not need to use Ajax. You can set your page to AutoEventWireUp = "false" and handle all events manually. Circle the Page_Load event on the click button and voila.

0
source

Source: https://habr.com/ru/post/1749103/


All Articles