diff options
Diffstat (limited to 'src/DotNetOpenAuth.AspNet/Clients/OAuth')
3 files changed, 28 insertions, 3 deletions
diff --git a/src/DotNetOpenAuth.AspNet/Clients/OAuth/DotNetOpenAuthWebConsumer.cs b/src/DotNetOpenAuth.AspNet/Clients/OAuth/DotNetOpenAuthWebConsumer.cs index 9979d97..9757f30 100644 --- a/src/DotNetOpenAuth.AspNet/Clients/OAuth/DotNetOpenAuthWebConsumer.cs +++ b/src/DotNetOpenAuth.AspNet/Clients/OAuth/DotNetOpenAuthWebConsumer.cs @@ -16,7 +16,7 @@ namespace DotNetOpenAuth.AspNet.Clients { /// <summary> /// The dot net open auth web consumer. /// </summary> - public class DotNetOpenAuthWebConsumer : IOAuthWebWorker { + public class DotNetOpenAuthWebConsumer : IOAuthWebWorker, IDisposable { #region Constants and Fields /// <summary> @@ -90,5 +90,28 @@ namespace DotNetOpenAuth.AspNet.Clients { } #endregion + + #region IDisposable members + + /// <summary> + /// Performs application-defined tasks associated with freeing, releasing, or resetting unmanaged resources. + /// </summary> + /// <filterpriority>2</filterpriority> + public void Dispose() { + this.Dispose(true); + GC.SuppressFinalize(this); + } + + #endregion + + /// <summary> + /// Releases unmanaged and - optionally - managed resources + /// </summary> + /// <param name="disposing"><c>true</c> to release both managed and unmanaged resources; <c>false</c> to release only unmanaged resources.</param> + protected virtual void Dispose(bool disposing) { + if (disposing) { + this._webConsumer.Dispose(); + } + } } } diff --git a/src/DotNetOpenAuth.AspNet/Clients/OAuth/OAuthClient.cs b/src/DotNetOpenAuth.AspNet/Clients/OAuth/OAuthClient.cs index bae3f82..4152f0a 100644 --- a/src/DotNetOpenAuth.AspNet/Clients/OAuth/OAuthClient.cs +++ b/src/DotNetOpenAuth.AspNet/Clients/OAuth/OAuthClient.cs @@ -6,6 +6,7 @@ namespace DotNetOpenAuth.AspNet.Clients { using System; + using System.Diagnostics.CodeAnalysis; using System.Web; using DotNetOpenAuth.Messaging; using DotNetOpenAuth.OAuth; @@ -50,6 +51,7 @@ namespace DotNetOpenAuth.AspNet.Clients { /// <param name="tokenManager"> /// The token Manager. /// </param> + [SuppressMessage("Microsoft.Reliability", "CA2000:Dispose objects before losing scope", Justification = "I don't know how to ensure this rule is followed given this API")] protected OAuthClient( string providerName, ServiceProviderDescription serviceDescription, IConsumerTokenManager tokenManager) : this(providerName, new DotNetOpenAuthWebConsumer(serviceDescription, tokenManager)) {} diff --git a/src/DotNetOpenAuth.AspNet/Clients/OAuth/TwitterClient.cs b/src/DotNetOpenAuth.AspNet/Clients/OAuth/TwitterClient.cs index 66a6a95..01318b8 100644 --- a/src/DotNetOpenAuth.AspNet/Clients/OAuth/TwitterClient.cs +++ b/src/DotNetOpenAuth.AspNet/Clients/OAuth/TwitterClient.cs @@ -79,8 +79,8 @@ namespace DotNetOpenAuth.AspNet.Clients { string userId = response.ExtraData["user_id"]; string userName = response.ExtraData["screen_name"]; - string profileRequestUrl = "http://api.twitter.com/1/users/show.xml?user_id=" - + MessagingUtilities.EscapeUriDataStringRfc3986(userId); + var profileRequestUrl = new Uri("http://api.twitter.com/1/users/show.xml?user_id=" + + MessagingUtilities.EscapeUriDataStringRfc3986(userId)); var profileEndpoint = new MessageReceivingEndpoint(profileRequestUrl, HttpDeliveryMethods.GetRequest); HttpWebRequest request = this.WebWorker.PrepareAuthorizedRequest(profileEndpoint, accessToken); |