summaryrefslogtreecommitdiffstats
path: root/src
diff options
context:
space:
mode:
authorAndrew Arnott <andrewarnott@gmail.com>2013-03-04 15:02:41 -0800
committerAndrew Arnott <andrewarnott@gmail.com>2013-03-04 15:02:41 -0800
commitbbb0214b9f41ad8bcd44eba3714b463eee29fe86 (patch)
tree30787ba8be3b39fce16dc7d32f1e6f6ce177340c /src
parent9c7bd4ad8a4de0147ad93d00813eb4874e031477 (diff)
downloadDotNetOpenAuth-bbb0214b9f41ad8bcd44eba3714b463eee29fe86.zip
DotNetOpenAuth-bbb0214b9f41ad8bcd44eba3714b463eee29fe86.tar.gz
DotNetOpenAuth-bbb0214b9f41ad8bcd44eba3714b463eee29fe86.tar.bz2
Changed all ASP.NET async void event handlers to use RegisterAsyncTask, which avoids bugs in ASP.NET.
Diffstat (limited to 'src')
-rw-r--r--src/DotNetOpenAuth.OpenId.RelyingParty.UI/OpenId/RelyingParty/OpenIdLogin.cs35
1 files changed, 20 insertions, 15 deletions
diff --git a/src/DotNetOpenAuth.OpenId.RelyingParty.UI/OpenId/RelyingParty/OpenIdLogin.cs b/src/DotNetOpenAuth.OpenId.RelyingParty.UI/OpenId/RelyingParty/OpenIdLogin.cs
index f61f824..2f0a65c 100644
--- a/src/DotNetOpenAuth.OpenId.RelyingParty.UI/OpenId/RelyingParty/OpenIdLogin.cs
+++ b/src/DotNetOpenAuth.OpenId.RelyingParty.UI/OpenId/RelyingParty/OpenIdLogin.cs
@@ -934,21 +934,26 @@ idselector_input_id = '" + this.ClientID + @"';
/// </summary>
/// <param name="sender">The source of the event.</param>
/// <param name="e">The <see cref="System.EventArgs"/> instance containing the event data.</param>
- private async void LoginButton_Click(object sender, EventArgs e) {
- if (!this.Page.IsValid) {
- return;
- }
-
- var authenticationRequests = await this.CreateRequestsAsync(CancellationToken.None);
- IAuthenticationRequest request = authenticationRequests.FirstOrDefault();
- if (request != null) {
- await this.LogOnAsync(request, CancellationToken.None);
- } else {
- if (!string.IsNullOrEmpty(this.FailedMessageText)) {
- this.errorLabel.Text = string.Format(CultureInfo.CurrentCulture, this.FailedMessageText, OpenIdStrings.OpenIdEndpointNotFound);
- this.errorLabel.Visible = true;
- }
- }
+ private void LoginButton_Click(object sender, EventArgs e) {
+ this.Page.RegisterAsyncTask(
+ new PageAsyncTask(
+ async ct => {
+ if (!this.Page.IsValid) {
+ return;
+ }
+
+ var authenticationRequests = await this.CreateRequestsAsync(CancellationToken.None);
+ IAuthenticationRequest request = authenticationRequests.FirstOrDefault();
+ if (request != null) {
+ await this.LogOnAsync(request, CancellationToken.None);
+ } else {
+ if (!string.IsNullOrEmpty(this.FailedMessageText)) {
+ this.errorLabel.Text = string.Format(
+ CultureInfo.CurrentCulture, this.FailedMessageText, OpenIdStrings.OpenIdEndpointNotFound);
+ this.errorLabel.Visible = true;
+ }
+ }
+ }));
}
/// <summary>