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;
46 [TypeForwardedFrom ("System.Web.Abstractions, Version=3.5.0.0, Culture=Neutral, PublicKeyToken=31bf3856ad364e35")]
47 [AspNetHostingPermission (SecurityAction.InheritanceDemand, Level = AspNetHostingPermissionLevel.Minimal)]
48 [AspNetHostingPermission (SecurityAction.LinkDemand, Level = AspNetHostingPermissionLevel.Minimal)]
49 public class HttpResponseWrapper : HttpResponseBase
53 public HttpResponseWrapper (HttpResponse httpResponse)
55 if (httpResponse == null)
56 throw new ArgumentNullException ("httpResponse");
60 public override bool Buffer {
61 get { return w.Buffer; }
62 set { w.Buffer = value; }
65 public override bool BufferOutput {
66 get { return w.BufferOutput; }
67 set { w.BufferOutput = value; }
70 public override HttpCachePolicyBase Cache {
71 get { return new HttpCachePolicyWrapper (w.Cache); }
74 public override string CacheControl {
75 get { return w.CacheControl; }
76 set { w.CacheControl = value; }
79 public override string Charset {
80 get { return w.Charset; }
81 set { w.Charset = value; }
84 public override CancellationToken ClientDisconnectedToken {
85 get { return CancellationToken.None; }
88 public override Encoding ContentEncoding {
89 get { return w.ContentEncoding; }
90 set { w.ContentEncoding = value; }
93 public override string ContentType {
94 get { return w.ContentType; }
95 set { w.ContentType = value; }
98 public override HttpCookieCollection Cookies {
99 get { return w.Cookies; }
102 public override int Expires {
103 get { return w.Expires; }
104 set { w.Expires = value; }
107 public override DateTime ExpiresAbsolute {
108 get { return w.ExpiresAbsolute; }
109 set { w.ExpiresAbsolute = value; }
112 public override Stream Filter {
113 get { return w.Filter; }
114 set { w.Filter = value; }
117 public override Encoding HeaderEncoding {
118 get { return w.HeaderEncoding; }
119 set { w.HeaderEncoding = value; }
122 public override NameValueCollection Headers {
123 get { return w.Headers; }
126 public override bool IsClientConnected {
127 get { return w.IsClientConnected; }
130 public override bool IsRequestBeingRedirected {
131 get { return w.IsRequestBeingRedirected; }
134 public override TextWriter Output {
135 get { return w.Output; }
136 set { w.Output = value; }
139 public override Stream OutputStream {
140 get { return w.OutputStream; }
143 public override string RedirectLocation {
144 get { return w.RedirectLocation; }
145 set { w.RedirectLocation = value; }
148 public override string Status {
149 get { return w.Status; }
150 set { w.Status = value; }
153 public override int StatusCode {
154 get { return w.StatusCode; }
155 set { w.StatusCode = value; }
158 public override string StatusDescription {
159 get { return w.StatusDescription; }
160 set { w.StatusDescription = value; }
163 public override int SubStatusCode {
164 get { return w.SubStatusCode; }
165 set { w.SubStatusCode = value; }
168 public override bool SuppressContent {
169 get { return w.SuppressContent; }
170 set { w.SuppressContent = value; }
173 public override bool SuppressFormsAuthenticationRedirect {
174 get { return w.SuppressFormsAuthenticationRedirect; }
175 set { w.SuppressFormsAuthenticationRedirect = value; }
178 public override bool TrySkipIisCustomErrors {
179 get { return w.TrySkipIisCustomErrors; }
180 set { w.TrySkipIisCustomErrors = value; }
183 public override void AddCacheDependency (params CacheDependency [] dependencies)
185 w.AddCacheDependency (dependencies);
188 public override void AddCacheItemDependencies (ArrayList cacheKeys)
190 w.AddCacheItemDependencies (cacheKeys);
193 public override void AddCacheItemDependencies (string [] cacheKeys)
195 w.AddCacheItemDependencies (cacheKeys);
198 public override void AddCacheItemDependency (string cacheKey)
200 w.AddCacheItemDependency (cacheKey);
203 public override void AddFileDependencies (ArrayList filenames)
205 w.AddFileDependencies (filenames);
208 public override void AddFileDependencies (string [] filenames)
210 w.AddFileDependencies (filenames);
213 public override void AddFileDependency (string filename)
215 w.AddFileDependency (filename);
218 public override void AddHeader (string name, string value)
220 w.AddHeader (name, value);
223 public override void AppendCookie (HttpCookie cookie)
225 w.AppendCookie (cookie);
228 public override void AppendHeader (string name, string value)
230 w.AppendHeader (name, value);
233 public override void AppendToLog (string param)
235 w.AppendToLog (param);
238 public override string ApplyAppPathModifier (string overridePath)
240 return w.ApplyAppPathModifier (overridePath);
243 public override void BinaryWrite (byte [] buffer)
245 w.BinaryWrite (buffer);
248 public override void Clear ()
253 public override void ClearContent ()
258 public override void ClearHeaders ()
263 public override void Close ()
268 public override void DisableKernelCache ()
270 w.DisableKernelCache ();
273 public override void End ()
278 public override void Flush ()
283 public override void Pics (string value)
288 public override void Redirect (string url)
293 public override void Redirect (string url, bool endResponse)
295 w.Redirect (url, endResponse);
297 public override void RedirectPermanent (string url)
299 w.RedirectPermanent (url);
302 public override void RedirectPermanent (string url, bool endResponse)
304 w.RedirectPermanent (url, endResponse);
307 public override void RemoveOutputCacheItem (string path, string providerName)
309 HttpResponse.RemoveOutputCacheItem (path, providerName);
311 public override void RemoveOutputCacheItem (string path)
313 HttpResponse.RemoveOutputCacheItem (path);
316 public override void SetCookie (HttpCookie cookie)
318 w.SetCookie (cookie);
321 public override void TransmitFile (string filename)
323 w.TransmitFile (filename);
326 public override void TransmitFile (string filename, long offset, long length)
328 w.TransmitFile (filename, offset, length);
331 public override void Write (char ch)
336 public override void Write (object obj)
341 public override void Write (string s)
346 public override void Write (char [] buffer, int index, int count)
348 w.Write (buffer, index, count);
351 public override void WriteFile (string filename)
353 w.WriteFile (filename);
356 public override void WriteFile (string filename, bool readIntoMemory)
358 w.WriteFile (filename, readIntoMemory);
361 public override void WriteFile (IntPtr fileHandle, long offset, long size)
363 w.WriteFile (fileHandle, offset, size);
366 public override void WriteFile (string filename, long offset, long size)
368 w.WriteFile (filename, offset, size);
371 public override void WriteSubstitution (HttpResponseSubstitutionCallback callback)
373 w.WriteSubstitution (callback);