2 // HttpRequestWrapper.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;
43 using System.Security.Authentication.ExtendedProtection;
44 using System.Web.Routing;
48 [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 HttpRequestWrapper : HttpRequestBase
55 public HttpRequestWrapper (HttpRequest httpRequest)
57 if (httpRequest == null)
58 throw new ArgumentNullException ("httpRequest");
62 public override string [] AcceptTypes {
63 get { return w.AcceptTypes; }
66 public override string AnonymousID {
67 get { return w.AnonymousID; }
70 public override string ApplicationPath {
71 get { return w.ApplicationPath; }
74 public override string AppRelativeCurrentExecutionFilePath {
75 get { return w.AppRelativeCurrentExecutionFilePath; }
78 public override HttpBrowserCapabilitiesBase Browser {
79 get { return new HttpBrowserCapabilitiesWrapper (w.Browser); }
82 public override HttpClientCertificate ClientCertificate {
83 get { return w.ClientCertificate; }
86 public override Encoding ContentEncoding {
87 get { return w.ContentEncoding; }
88 set { w.ContentEncoding = value; }
91 public override int ContentLength {
92 get { return w.ContentLength; }
95 public override string ContentType {
96 get { return w.ContentType; }
97 set { w.ContentType = value; }
100 public override HttpCookieCollection Cookies {
101 get { return w.Cookies; }
104 public override string CurrentExecutionFilePath {
105 get { return w.CurrentExecutionFilePath; }
108 public override string FilePath {
109 get { return w.FilePath; }
112 public override HttpFileCollectionBase Files {
113 get { return new HttpFileCollectionWrapper (w.Files); }
116 public override Stream Filter {
117 get { return w.Filter; }
118 set { w.Filter = value; }
121 public override NameValueCollection Form {
122 get { return w.Form; }
125 public override NameValueCollection Headers {
126 get { return w.Headers; }
129 public override string HttpMethod {
130 get { return w.HttpMethod; }
132 public override ChannelBinding HttpChannelBinding {
133 get { return w.HttpChannelBinding; }
135 public override Stream InputStream {
136 get { return w.InputStream; }
139 public override bool IsAuthenticated {
140 get { return w.IsAuthenticated; }
143 public override bool IsLocal {
144 get { return w.IsLocal; }
147 public override bool IsSecureConnection {
148 get { return w.IsSecureConnection; }
151 public override string this [string key] {
152 get { return w [key]; }
155 public override WindowsIdentity LogonUserIdentity {
156 get { return w.LogonUserIdentity; }
159 public override NameValueCollection Params {
160 get { return w.Params; }
163 public override string Path {
164 get { return w.Path; }
167 public override string PathInfo {
168 get { return w.PathInfo; }
171 public override string PhysicalApplicationPath {
172 get { return w.PhysicalApplicationPath; }
175 public override string PhysicalPath {
176 get { return w.PhysicalPath; }
179 public override NameValueCollection QueryString {
180 get { return w.QueryString; }
183 public override string RawUrl {
184 get { return w.RawUrl; }
187 public override string RequestType {
188 get { return w.RequestType; }
189 set { w.RequestType = value; }
191 public override RequestContext RequestContext {
192 get { return w.RequestContext; }
193 internal set { w.RequestContext = value; }
195 public override NameValueCollection ServerVariables {
196 get { return w.ServerVariables; }
199 public override int TotalBytes {
200 get { return w.TotalBytes; }
203 public override UnvalidatedRequestValuesBase Unvalidated {
204 get { return new UnvalidatedRequestValuesWrapper (w.Unvalidated); }
207 public override ReadEntityBodyMode ReadEntityBodyMode {
208 get { return ReadEntityBodyMode.Classic; }
211 public override Uri Url {
212 get { return w.Url; }
215 public override Uri UrlReferrer {
216 get { return w.UrlReferrer; }
219 public override string UserAgent {
220 get { return w.UserAgent; }
223 public override string UserHostAddress {
224 get { return w.UserHostAddress; }
227 public override string UserHostName {
228 get { return w.UserHostName; }
231 public override string [] UserLanguages {
232 get { return w.UserLanguages; }
237 w.WorkerRequest.CloseConnection();
240 public override byte [] BinaryRead (int count)
242 return w.BinaryRead (count);
245 public override int [] MapImageCoordinates (string imageFieldName)
247 return w.MapImageCoordinates (imageFieldName);
250 public override string MapPath (string overridePath)
252 return w.MapPath (overridePath);
255 public override string MapPath (string overridePath, string baseVirtualDir, bool allowCrossAppMapping)
257 return w.MapPath (overridePath, baseVirtualDir, allowCrossAppMapping);
260 public override void SaveAs (string filename, bool includeHeaders)
262 w.SaveAs (filename, includeHeaders);
265 public override void ValidateInput ()