Diclaimer: I did not use async / await , but the following is based on my reading of documents.
As I understand it, whenever you have await in your code, it will call the task provided asynchronously, and the rest of the method will actually be converted to a callback method. Therefore, in this case, since Page_Load is asynchronous, when it starts it, and it comes to wait, it will return control to the caller, waiting for the completion of its asynchronous task.
In the case of the Page_Load event, it seems to me that it will look as if it ended with time, the page life cycle will continue in the next step.
The reason for the differences is that in the first example, although it will continue with the life cycle, the callback will be almost immediate, so Response.Redirect will work almost immediately before the rest of the page can do anything.
In the case of the second, you have this delay of 1000, and during this time the page will continue to run other things, and only when this delay ends, respone.redirect is triggered. This can happen after the answer (due to an error) has already been started.
So essentially async includes await , but what await does seems to be a bit more than you expect.
Chris
source share