diff options
author | Andrew Arnott <andrewarnott@gmail.com> | 2011-09-28 08:00:57 -0700 |
---|---|---|
committer | Andrew Arnott <andrewarnott@gmail.com> | 2011-09-28 08:38:58 -0700 |
commit | 1e2f941bcdb7bfba15e90b78b19487c8c3e91be3 (patch) | |
tree | 86be80a5300096a9b2560c2851943794daf72ca5 /src | |
parent | d1ba5762185773b1f75a4dee03a0a203530b2300 (diff) | |
download | DotNetOpenAuth-1e2f941bcdb7bfba15e90b78b19487c8c3e91be3.zip DotNetOpenAuth-1e2f941bcdb7bfba15e90b78b19487c8c3e91be3.tar.gz DotNetOpenAuth-1e2f941bcdb7bfba15e90b78b19487c8c3e91be3.tar.bz2 |
Reverted part of commit 2704b0fb445.
Reverses some of the Send->Respond changes made that are or may be invoked from ASP.NET web forms, since web forms will render HTML after the end of the protocol message.
Diffstat (limited to 'src')
7 files changed, 24 insertions, 10 deletions
diff --git a/src/DotNetOpenAuth/Messaging/Channel.cs b/src/DotNetOpenAuth/Messaging/Channel.cs index bff395b..872fc1c 100644 --- a/src/DotNetOpenAuth/Messaging/Channel.cs +++ b/src/DotNetOpenAuth/Messaging/Channel.cs @@ -298,7 +298,7 @@ namespace DotNetOpenAuth.Messaging { /// <remarks> /// Requires an HttpContext.Current context. /// </remarks> - [EditorBrowsable(EditorBrowsableState.Never), Obsolete("Use the Respond method instead, and prepare for execution to continue on this page beyond the call to Respond.")] + [EditorBrowsable(EditorBrowsableState.Never)] public void Send(IProtocolMessage message) { Contract.Requires<InvalidOperationException>(HttpContext.Current != null, MessagingStrings.CurrentHttpContextRequired); Contract.Requires<ArgumentNullException>(message != null); @@ -309,10 +309,14 @@ namespace DotNetOpenAuth.Messaging { /// Sends an indirect message (either a request or response) /// or direct message response for transmission to a remote party /// and skips most of the remaining ASP.NET request handling pipeline. + /// Not safe to call from ASP.NET web forms. /// </summary> /// <param name="message">The one-way message to send</param> /// <remarks> /// Requires an HttpContext.Current context. + /// This call is not safe to make from an ASP.NET web form (.aspx file or code-behind) because + /// ASP.NET will render HTML after the protocol message has been sent, which will corrupt the response. + /// Use the <see cref="Send"/> method instead for web forms. /// </remarks> public void Respond(IProtocolMessage message) { Contract.Requires<InvalidOperationException>(HttpContext.Current != null, MessagingStrings.CurrentHttpContextRequired); diff --git a/src/DotNetOpenAuth/Messaging/OutgoingWebResponse.cs b/src/DotNetOpenAuth/Messaging/OutgoingWebResponse.cs index b4bc22d..d9cedf6 100644 --- a/src/DotNetOpenAuth/Messaging/OutgoingWebResponse.cs +++ b/src/DotNetOpenAuth/Messaging/OutgoingWebResponse.cs @@ -126,7 +126,7 @@ namespace DotNetOpenAuth.Messaging { /// <remarks> /// Requires a current HttpContext. /// </remarks> - [EditorBrowsable(EditorBrowsableState.Never), Obsolete("Use the Respond method instead, and prepare for execution to continue on this page beyond the call to Respond.")] + [EditorBrowsable(EditorBrowsableState.Never)] public virtual void Send() { Contract.Requires<InvalidOperationException>(HttpContext.Current != null && HttpContext.Current.Request != null, MessagingStrings.HttpContextRequired); @@ -140,7 +140,7 @@ namespace DotNetOpenAuth.Messaging { /// <param name="context">The context of the HTTP request whose response should be set. /// Typically this is <see cref="HttpContext.Current"/>.</param> /// <exception cref="ThreadAbortException">Typically thrown by ASP.NET in order to prevent additional data from the page being sent to the client and corrupting the response.</exception> - [EditorBrowsable(EditorBrowsableState.Never), Obsolete("Use the Respond method instead, and prepare for execution to continue on this page beyond the call to Respond.")] + [EditorBrowsable(EditorBrowsableState.Never)] public virtual void Send(HttpContext context) { this.Respond(context, true); } @@ -149,9 +149,13 @@ namespace DotNetOpenAuth.Messaging { /// Automatically sends the appropriate response to the user agent /// and signals ASP.NET to short-circuit the page execution pipeline /// now that the response has been completed. + /// Not safe to call from ASP.NET web forms. /// </summary> /// <remarks> /// Requires a current HttpContext. + /// This call is not safe to make from an ASP.NET web form (.aspx file or code-behind) because + /// ASP.NET will render HTML after the protocol message has been sent, which will corrupt the response. + /// Use the <see cref="Send"/> method instead for web forms. /// </remarks> public virtual void Respond() { Contract.Requires<InvalidOperationException>(HttpContext.Current != null && HttpContext.Current.Request != null, MessagingStrings.HttpContextRequired); @@ -163,9 +167,15 @@ namespace DotNetOpenAuth.Messaging { /// Automatically sends the appropriate response to the user agent /// and signals ASP.NET to short-circuit the page execution pipeline /// now that the response has been completed. + /// Not safe to call from ASP.NET web forms. /// </summary> /// <param name="context">The context of the HTTP request whose response should be set. /// Typically this is <see cref="HttpContext.Current"/>.</param> + /// <remarks> + /// This call is not safe to make from an ASP.NET web form (.aspx file or code-behind) because + /// ASP.NET will render HTML after the protocol message has been sent, which will corrupt the response. + /// Use the <see cref="Send"/> method instead for web forms. + /// </remarks> public virtual void Respond(HttpContext context) { Contract.Requires<ArgumentNullException>(context != null); diff --git a/src/DotNetOpenAuth/OAuth2/WebServerClient.cs b/src/DotNetOpenAuth/OAuth2/WebServerClient.cs index a6fae13..0063ae0 100644 --- a/src/DotNetOpenAuth/OAuth2/WebServerClient.cs +++ b/src/DotNetOpenAuth/OAuth2/WebServerClient.cs @@ -45,7 +45,7 @@ namespace DotNetOpenAuth.OAuth2 { var authorizationState = new AuthorizationState(scope) { Callback = returnTo, }; - this.PrepareRequestUserAuthorization(authorizationState, state).Respond(); + this.PrepareRequestUserAuthorization(authorizationState, state).Send(); } /// <summary> diff --git a/src/DotNetOpenAuth/OpenId/Provider/OpenIdProvider.cs b/src/DotNetOpenAuth/OpenId/Provider/OpenIdProvider.cs index 58dfc2f..dbab28b 100644 --- a/src/DotNetOpenAuth/OpenId/Provider/OpenIdProvider.cs +++ b/src/DotNetOpenAuth/OpenId/Provider/OpenIdProvider.cs @@ -326,7 +326,7 @@ namespace DotNetOpenAuth.OpenId.Provider { /// </remarks> /// <exception cref="InvalidOperationException">Thrown if <see cref="IRequest.IsResponseReady"/> is <c>false</c>.</exception> [SuppressMessage("Microsoft.Performance", "CA1800:DoNotCastUnnecessarily", Justification = "Code Contract requires that we cast early.")] - [EditorBrowsable(EditorBrowsableState.Never), Obsolete("Use the Respond method instead, and prepare for execution to continue on this page beyond the call to Respond.")] + [EditorBrowsable(EditorBrowsableState.Never)] public void SendResponse(IRequest request) { Contract.Requires<InvalidOperationException>(HttpContext.Current != null, MessagingStrings.CurrentHttpContextRequired); Contract.Requires<ArgumentNullException>(request != null); @@ -397,7 +397,7 @@ namespace DotNetOpenAuth.OpenId.Provider { Contract.Requires<ArgumentNullException>(claimedIdentifier != null); Contract.Requires<ArgumentNullException>(localIdentifier != null); - this.PrepareUnsolicitedAssertion(providerEndpoint, relyingPartyRealm, claimedIdentifier, localIdentifier, extensions).Respond(); + this.PrepareUnsolicitedAssertion(providerEndpoint, relyingPartyRealm, claimedIdentifier, localIdentifier, extensions).Send(); } /// <summary> diff --git a/src/DotNetOpenAuth/OpenId/Provider/ProviderEndpoint.cs b/src/DotNetOpenAuth/OpenId/Provider/ProviderEndpoint.cs index 821d95c..4a90843 100644 --- a/src/DotNetOpenAuth/OpenId/Provider/ProviderEndpoint.cs +++ b/src/DotNetOpenAuth/OpenId/Provider/ProviderEndpoint.cs @@ -180,7 +180,7 @@ namespace DotNetOpenAuth.OpenId.Provider { public static void SendResponse() { var pendingRequest = PendingRequest; PendingRequest = null; - Provider.Respond(pendingRequest); + Provider.SendResponse(pendingRequest); } /// <summary> @@ -222,8 +222,8 @@ namespace DotNetOpenAuth.OpenId.Provider { } } if (request.IsResponseReady) { - Provider.Respond(request); PendingAuthenticationRequest = null; + Provider.SendResponse(request); } } } diff --git a/src/DotNetOpenAuth/OpenId/RelyingParty/AuthenticationRequest.cs b/src/DotNetOpenAuth/OpenId/RelyingParty/AuthenticationRequest.cs index 8bbf04f..8d8f0da 100644 --- a/src/DotNetOpenAuth/OpenId/RelyingParty/AuthenticationRequest.cs +++ b/src/DotNetOpenAuth/OpenId/RelyingParty/AuthenticationRequest.cs @@ -300,7 +300,7 @@ namespace DotNetOpenAuth.OpenId.RelyingParty { /// This method requires an ASP.NET HttpContext. /// </remarks> public void RedirectToProvider() { - this.RedirectingResponse.Respond(); + this.RedirectingResponse.Send(); } #endregion diff --git a/src/DotNetOpenAuth/OpenId/RelyingParty/OpenIdRelyingPartyAjaxControlBase.cs b/src/DotNetOpenAuth/OpenId/RelyingParty/OpenIdRelyingPartyAjaxControlBase.cs index 551534a..866f942 100644 --- a/src/DotNetOpenAuth/OpenId/RelyingParty/OpenIdRelyingPartyAjaxControlBase.cs +++ b/src/DotNetOpenAuth/OpenId/RelyingParty/OpenIdRelyingPartyAjaxControlBase.cs @@ -428,7 +428,7 @@ namespace DotNetOpenAuth.OpenId.RelyingParty { this.RelyingParty.Channel.GetRequestFromContext(), callback); - response.Respond(); + response.Send(); } /// <summary> |