Level Extreme platform
Subscription
Corporate profile
Products & Services
Support
Legal
Français
Using Await and async in ASP.NET app
Message
 
 
General information
Forum:
ASP.NET
Category:
Other
Miscellaneous
Thread ID:
01634709
Message ID:
01634742
Views:
24
>>>To be clear: Do you want to simply notify the user that the request to send an email has been received - or that the email was successfully sent ?
>>>
>>>If the former then you could just use a call to an async task without the await. In essence :
public bool EmailSendRequest(Email e)
>>>        {
>>>            SendEmail(e);
>>>            return true;
>>>        }
>>>
>>> public async Task SendEmail(Email e)
>>>        {
>>>            //Do whatever to send etc.
>>>        }
If you wanted to notify the user on the actual success/failure of the send you could use something like SignalR to push to the user later....
>>
>>Therefore it looks like "await" is not necessary.
>
>If you wanted code to run after the SendEmail() task completed you could use await and add that code after the call. But to use 'await' the enclosing method must be an async task.....
>
>> I am not at all familiar with SignalR, will Google it.
>
>In simple terms SignalR would allow your client side to listen for messages sent by the server so the browser could be sent a notification if the email send failed

Please confirm that I understand it correctly. If I DO NOT use await the code runs and is forgotten. But if some code has to run AFTER the process (e.g. email procedure ) I have to have AWAIT and put the follow-up code after AWAIT? Correct?

As far as SignalR, it sounds very clear the way you explain it. I am sure it will be not so simple to implement.
Thank you very much.
"The creative process is nothing but a series of crises." Isaac Bashevis Singer
"My experience is that as soon as people are old enough to know better, they don't know anything at all." Oscar Wilde
"If a nation values anything more than freedom, it will lose its freedom; and the irony of it is that if it is comfort or money that it values more, it will lose that too." W.Somerset Maugham
Previous
Next
Reply
Map
View

Click here to load this message in the networking platform