2 // HttpResponseWrapper.cs
5 // Atsushi Enomoto <atsushi@ximian.com>
7 // Copyright (C) 2008 Novell Inc. http://novell.com
11 // Permission is hereby granted, free of charge, to any person obtaining
12 // a copy of this software and associated documentation files (the
13 // "Software"), to deal in the Software without restriction, including
14 // without limitation the rights to use, copy, modify, merge, publish,
15 // distribute, sublicense, and/or sell copies of the Software, and to
16 // permit persons to whom the Software is furnished to do so, subject to
17 // the following conditions:
19 // The above copyright notice and this permission notice shall be
20 // included in all copies or substantial portions of the Software.
22 // THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
23 // EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
24 // MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
25 // NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE
26 // LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION
27 // OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION
28 // WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
31 using System.Collections;
32 using System.Collections.Generic;
33 using System.Collections.Specialized;
34 using System.Globalization;
36 using System.Runtime.CompilerServices;
37 using System.Runtime.Serialization;
38 using System.Security.Permissions;
39 using System.Security.Principal;
41 using System.Web.Caching;
42 using System.Threading;
47 [TypeForwardedFrom ("System.Web.Abstractions, Version=3.5.0.0, Culture=Neutral, PublicKeyToken=31bf3856ad364e35")]
49 [AspNetHostingPermission (SecurityAction.InheritanceDemand, Level = AspNetHostingPermissionLevel.Minimal)]
50 [AspNetHostingPermission (SecurityAction.LinkDemand, Level = AspNetHostingPermissionLevel.Minimal)]
51 public class HttpResponseWrapper : HttpResponseBase
55 public HttpResponseWrapper (HttpResponse httpResponse)
57 if (httpResponse == null)
58 throw new ArgumentNullException ("httpResponse");
62 public override bool Buffer {
63 get { return w.Buffer; }
64 set { w.Buffer = value; }
67 public override bool BufferOutput {
68 get { return w.BufferOutput; }
69 set { w.BufferOutput = value; }
72 public override HttpCachePolicyBase Cache {
73 get { return new HttpCachePolicyWrapper (w.Cache); }
76 public override string CacheControl {
77 get { return w.CacheControl; }
78 set { w.CacheControl = value; }
81 public override string Charset {
82 get { return w.Charset; }
83 set { w.Charset = value; }
87 public override CancellationToken ClientDisconnectedToken {
88 get { return CancellationToken.None; }
92 public override Encoding ContentEncoding {
93 get { return w.ContentEncoding; }
94 set { w.ContentEncoding = value; }
97 public override string ContentType {
98 get { return w.ContentType; }
99 set { w.ContentType = value; }
102 public override HttpCookieCollection Cookies {
103 get { return w.Cookies; }
106 public override int Expires {
107 get { return w.Expires; }
108 set { w.Expires = value; }
111 public override DateTime ExpiresAbsolute {
112 get { return w.ExpiresAbsolute; }
113 set { w.ExpiresAbsolute = value; }
116 public override Stream Filter {
117 get { return w.Filter; }
118 set { w.Filter = value; }
121 public override Encoding HeaderEncoding {
122 get { return w.HeaderEncoding; }
123 set { w.HeaderEncoding = value; }
126 public override NameValueCollection Headers {
127 get { return w.Headers; }
130 public override bool IsClientConnected {
131 get { return w.IsClientConnected; }
134 public override bool IsRequestBeingRedirected {
135 get { return w.IsRequestBeingRedirected; }
138 public override TextWriter Output {
139 get { return w.Output; }
141 set { w.Output = value; }
145 public override Stream OutputStream {
146 get { return w.OutputStream; }
149 public override string RedirectLocation {
150 get { return w.RedirectLocation; }
151 set { w.RedirectLocation = value; }
154 public override string Status {
155 get { return w.Status; }
156 set { w.Status = value; }
159 public override int StatusCode {
160 get { return w.StatusCode; }
161 set { w.StatusCode = value; }
164 public override string StatusDescription {
165 get { return w.StatusDescription; }
166 set { w.StatusDescription = value; }
169 public override int SubStatusCode {
170 get { return w.SubStatusCode; }
171 set { w.SubStatusCode = value; }
174 public override bool SuppressContent {
175 get { return w.SuppressContent; }
176 set { w.SuppressContent = value; }
180 public override bool SuppressFormsAuthenticationRedirect {
181 get { return w.SuppressFormsAuthenticationRedirect; }
182 set { w.SuppressFormsAuthenticationRedirect = value; }
186 public override bool TrySkipIisCustomErrors {
187 get { return w.TrySkipIisCustomErrors; }
188 set { w.TrySkipIisCustomErrors = value; }
191 public override void AddCacheDependency (params CacheDependency [] dependencies)
193 w.AddCacheDependency (dependencies);
196 public override void AddCacheItemDependencies (ArrayList cacheKeys)
198 w.AddCacheItemDependencies (cacheKeys);
201 public override void AddCacheItemDependencies (string [] cacheKeys)
203 w.AddCacheItemDependencies (cacheKeys);
206 public override void AddCacheItemDependency (string cacheKey)
208 w.AddCacheItemDependency (cacheKey);
211 public override void AddFileDependencies (ArrayList filenames)
213 w.AddFileDependencies (filenames);
216 public override void AddFileDependencies (string [] filenames)
218 w.AddFileDependencies (filenames);
221 public override void AddFileDependency (string filename)
223 w.AddFileDependency (filename);
226 public override void AddHeader (string name, string value)
228 w.AddHeader (name, value);
231 public override void AppendCookie (HttpCookie cookie)
233 w.AppendCookie (cookie);
236 public override void AppendHeader (string name, string value)
238 w.AppendHeader (name, value);
241 public override void AppendToLog (string param)
243 w.AppendToLog (param);
246 public override string ApplyAppPathModifier (string overridePath)
248 return w.ApplyAppPathModifier (overridePath);
251 public override void BinaryWrite (byte [] buffer)
253 w.BinaryWrite (buffer);
256 public override void Clear ()
261 public override void ClearContent ()
266 public override void ClearHeaders ()
271 public override void Close ()
276 public override void DisableKernelCache ()
278 w.DisableKernelCache ();
281 public override void End ()
286 public override void Flush ()
291 public override void Pics (string value)
296 public override void Redirect (string url)
301 public override void Redirect (string url, bool endResponse)
303 w.Redirect (url, endResponse);
306 public override void RedirectPermanent (string url)
308 w.RedirectPermanent (url);
311 public override void RedirectPermanent (string url, bool endResponse)
313 w.RedirectPermanent (url, endResponse);
316 public override void RemoveOutputCacheItem (string path, string providerName)
318 HttpResponse.RemoveOutputCacheItem (path, providerName);
321 public override void RemoveOutputCacheItem (string path)
323 HttpResponse.RemoveOutputCacheItem (path);
326 public override void SetCookie (HttpCookie cookie)
328 w.SetCookie (cookie);
331 public override void TransmitFile (string filename)
333 w.TransmitFile (filename);
336 public override void TransmitFile (string filename, long offset, long length)
338 w.TransmitFile (filename, offset, length);
341 public override void Write (char ch)
346 public override void Write (object obj)
351 public override void Write (string s)
356 public override void Write (char [] buffer, int index, int count)
358 w.Write (buffer, index, count);
361 public override void WriteFile (string filename)
363 w.WriteFile (filename);
366 public override void WriteFile (string filename, bool readIntoMemory)
368 w.WriteFile (filename, readIntoMemory);
371 public override void WriteFile (IntPtr fileHandle, long offset, long size)
373 w.WriteFile (fileHandle, offset, size);
376 public override void WriteFile (string filename, long offset, long size)
378 w.WriteFile (filename, offset, size);
381 public override void WriteSubstitution (HttpResponseSubstitutionCallback callback)
383 w.WriteSubstitution (callback);