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.Serialization;
37 using System.Security.Permissions;
38 using System.Security.Principal;
40 using System.Web.Caching;
44 [AspNetHostingPermission (SecurityAction.InheritanceDemand, Level = AspNetHostingPermissionLevel.Minimal)]
45 [AspNetHostingPermission (SecurityAction.LinkDemand, Level = AspNetHostingPermissionLevel.Minimal)]
46 public class HttpRequestWrapper : HttpRequestBase
50 public HttpRequestWrapper (HttpRequest httpRequest)
52 if (httpRequest == null)
53 throw new ArgumentNullException ("httpRequest");
57 public override string [] AcceptTypes {
58 get { return w.AcceptTypes; }
61 public override string AnonymousID {
62 get { return w.AnonymousID; }
65 public override string ApplicationPath {
66 get { return w.ApplicationPath; }
69 public override string AppRelativeCurrentExecutionFilePath {
70 get { return w.AppRelativeCurrentExecutionFilePath; }
73 public override HttpBrowserCapabilitiesBase Browser {
74 get { return new HttpBrowserCapabilitiesWrapper (w.Browser); }
77 public override HttpClientCertificate ClientCertificate {
78 get { return w.ClientCertificate; }
81 public override Encoding ContentEncoding {
82 get { return w.ContentEncoding; }
83 set { w.ContentEncoding = value; }
86 public override int ContentLength {
87 get { return w.ContentLength; }
90 public override string ContentType {
91 get { return w.ContentType; }
92 set { w.ContentType = value; }
95 public override HttpCookieCollection Cookies {
96 get { return w.Cookies; }
99 public override string CurrentExecutionFilePath {
100 get { return w.CurrentExecutionFilePath; }
103 public override string FilePath {
104 get { return w.FilePath; }
107 public override HttpFileCollectionBase Files {
108 get { return new HttpFileCollectionWrapper (w.Files); }
111 public override Stream Filter {
112 get { return w.Filter; }
113 set { w.Filter = value; }
116 public override NameValueCollection Form {
117 get { return w.Form; }
120 public override NameValueCollection Headers {
121 get { return w.Headers; }
124 public override string HttpMethod {
125 get { return w.HttpMethod; }
128 public override Stream InputStream {
129 get { return w.InputStream; }
132 public override bool IsAuthenticated {
133 get { return w.IsAuthenticated; }
136 public override bool IsLocal {
137 get { return w.IsLocal; }
140 public override bool IsSecureConnection {
141 get { return w.IsSecureConnection; }
144 public override string this [string key] {
145 get { return w [key]; }
148 public override WindowsIdentity LogonUserIdentity {
149 get { return w.LogonUserIdentity; }
152 public override NameValueCollection Params {
153 get { return w.Params; }
156 public override string Path {
157 get { return w.Path; }
160 public override string PathInfo {
161 get { return w.PathInfo; }
164 public override string PhysicalApplicationPath {
165 get { return w.PhysicalApplicationPath; }
168 public override string PhysicalPath {
169 get { return w.PhysicalPath; }
172 public override NameValueCollection QueryString {
173 get { return w.QueryString; }
176 public override string RawUrl {
177 get { return w.RawUrl; }
180 public override string RequestType {
181 get { return w.RequestType; }
182 set { w.RequestType = value; }
185 public override NameValueCollection ServerVariables {
186 get { return w.ServerVariables; }
189 public override int TotalBytes {
190 get { return w.TotalBytes; }
193 public override Uri Url {
194 get { return w.Url; }
197 public override Uri UrlReferrer {
198 get { return w.UrlReferrer; }
201 public override string UserAgent {
202 get { return w.UserAgent; }
205 public override string UserHostAddress {
206 get { return w.UserHostAddress; }
209 public override string UserHostName {
210 get { return w.UserHostName; }
213 public override string [] UserLanguages {
214 get { return w.UserLanguages; }
217 public override byte [] BinaryRead (int count)
219 return w.BinaryRead (count);
222 public override int [] MapImageCoordinates (string imageFieldName)
224 return w.MapImageCoordinates (imageFieldName);
227 public override string MapPath (string overridePath)
229 return w.MapPath (overridePath);
232 public override string MapPath (string overridePath, string baseVirtualDir, bool allowCrossAppMapping)
234 return w.MapPath (overridePath, baseVirtualDir, allowCrossAppMapping);
237 public override void SaveAs (string filename, bool includeHeaders)
239 w.SaveAs (filename, includeHeaders);
242 public override void ValidateInput ()