summaryrefslogtreecommitdiffstats
path: root/src/DotNetOpenId/Util.cs
diff options
context:
space:
mode:
Diffstat (limited to 'src/DotNetOpenId/Util.cs')
-rw-r--r--src/DotNetOpenId/Util.cs17
1 files changed, 17 insertions, 0 deletions
diff --git a/src/DotNetOpenId/Util.cs b/src/DotNetOpenId/Util.cs
index 61986c6..1eb7c5f 100644
--- a/src/DotNetOpenId/Util.cs
+++ b/src/DotNetOpenId/Util.cs
@@ -3,6 +3,7 @@ using System.Collections.Generic;
using System.Collections.Specialized;
using System.Diagnostics;
using System.Globalization;
+using System.Net;
using System.Reflection;
using System.Text;
using System.Text.RegularExpressions;
@@ -148,6 +149,22 @@ namespace DotNetOpenId {
// session, but not the URL rewriting problem.
}
+ public static void ApplyHeadersToResponse(WebHeaderCollection headers, HttpResponse response) {
+ if (headers == null) throw new ArgumentNullException("headers");
+ if (response == null) throw new ArgumentNullException("response");
+ foreach (string headerName in headers) {
+ switch (headerName) {
+ case "Content-Type":
+ response.ContentType = headers[HttpResponseHeader.ContentType];
+ break;
+ // Add more special cases here as necessary.
+ default:
+ response.AddHeader(headerName, headers[headerName]);
+ break;
+ }
+ }
+ }
+
public static string GetRequiredArg(IDictionary<string, string> query, string key) {
if (query == null) throw new ArgumentNullException("query");
if (key == null) throw new ArgumentNullException("key");