summaryrefslogtreecommitdiffstats
path: root/src
diff options
context:
space:
mode:
Diffstat (limited to 'src')
-rw-r--r--src/DotNetOpenAuth/Messaging/Channel.cs22
1 files changed, 22 insertions, 0 deletions
diff --git a/src/DotNetOpenAuth/Messaging/Channel.cs b/src/DotNetOpenAuth/Messaging/Channel.cs
index 4c07f80..e70e5d6 100644
--- a/src/DotNetOpenAuth/Messaging/Channel.cs
+++ b/src/DotNetOpenAuth/Messaging/Channel.cs
@@ -14,6 +14,7 @@ namespace DotNetOpenAuth.Messaging {
using System.IO;
using System.Linq;
using System.Net;
+ using System.Net.Cache;
using System.Text;
using System.Threading;
using System.Web;
@@ -73,6 +74,11 @@ namespace DotNetOpenAuth.Messaging {
private List<IChannelBindingElement> incomingBindingElements = new List<IChannelBindingElement>();
/// <summary>
+ /// Backing store for the <see cref="CachePolicy"/> property.
+ /// </summary>
+ private RequestCachePolicy cachePolicy = new HttpRequestCachePolicy(HttpRequestCacheLevel.NoCacheNoStore);
+
+ /// <summary>
/// Initializes a new instance of the <see cref="Channel"/> class.
/// </summary>
/// <param name="messageTypeProvider">
@@ -139,6 +145,21 @@ namespace DotNetOpenAuth.Messaging {
}
/// <summary>
+ /// Gets or sets the cache policy to use for direct message requests.
+ /// </summary>
+ /// <value>Default is <see cref="HttpRequestCacheLevel.NoCacheNoStore"/>.</value>
+ protected RequestCachePolicy CachePolicy {
+ get {
+ return this.cachePolicy;
+ }
+
+ set {
+ ErrorUtilities.VerifyArgumentNotNull(value, "value");
+ this.cachePolicy = value;
+ }
+ }
+
+ /// <summary>
/// Sends an indirect message (either a request or response)
/// or direct message response for transmission to a remote party
/// and ends execution on the current page or handler.
@@ -645,6 +666,7 @@ namespace DotNetOpenAuth.Messaging {
var fields = serializer.Serialize(requestMessage);
HttpWebRequest httpRequest = (HttpWebRequest)WebRequest.Create(requestMessage.Recipient);
+ httpRequest.CachePolicy = this.CachePolicy;
httpRequest.Method = "POST";
httpRequest.ContentType = "application/x-www-form-urlencoded";
httpRequest.Headers[HttpRequestHeader.ContentEncoding] = PostEntityEncoding.WebName;