HttpRequestWrapper.cs 6.1 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251
  1. //
  2. // HttpRequestWrapper.cs
  3. //
  4. // Author:
  5. // Atsushi Enomoto <[email protected]>
  6. //
  7. // Copyright (C) 2008 Novell Inc. http://novell.com
  8. //
  9. //
  10. // Permission is hereby granted, free of charge, to any person obtaining
  11. // a copy of this software and associated documentation files (the
  12. // "Software"), to deal in the Software without restriction, including
  13. // without limitation the rights to use, copy, modify, merge, publish,
  14. // distribute, sublicense, and/or sell copies of the Software, and to
  15. // permit persons to whom the Software is furnished to do so, subject to
  16. // the following conditions:
  17. //
  18. // The above copyright notice and this permission notice shall be
  19. // included in all copies or substantial portions of the Software.
  20. //
  21. // THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
  22. // EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
  23. // MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
  24. // NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE
  25. // LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION
  26. // OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION
  27. // WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
  28. //
  29. using System;
  30. using System.Collections;
  31. using System.Collections.Generic;
  32. using System.Collections.Specialized;
  33. using System.Globalization;
  34. using System.IO;
  35. using System.Runtime.CompilerServices;
  36. using System.Runtime.Serialization;
  37. using System.Security.Permissions;
  38. using System.Security.Principal;
  39. using System.Text;
  40. using System.Web.Caching;
  41. namespace System.Web
  42. {
  43. #if NET_4_0
  44. [TypeForwardedFrom ("System.Web.Abstractions, Version=3.5.0.0, Culture=Neutral, PublicKeyToken=31bf3856ad364e35")]
  45. #endif
  46. [AspNetHostingPermission (SecurityAction.InheritanceDemand, Level = AspNetHostingPermissionLevel.Minimal)]
  47. [AspNetHostingPermission (SecurityAction.LinkDemand, Level = AspNetHostingPermissionLevel.Minimal)]
  48. public class HttpRequestWrapper : HttpRequestBase
  49. {
  50. HttpRequest w;
  51. public HttpRequestWrapper (HttpRequest httpRequest)
  52. {
  53. if (httpRequest == null)
  54. throw new ArgumentNullException ("httpRequest");
  55. w = httpRequest;
  56. }
  57. public override string [] AcceptTypes {
  58. get { return w.AcceptTypes; }
  59. }
  60. public override string AnonymousID {
  61. get { return w.AnonymousID; }
  62. }
  63. public override string ApplicationPath {
  64. get { return w.ApplicationPath; }
  65. }
  66. public override string AppRelativeCurrentExecutionFilePath {
  67. get { return w.AppRelativeCurrentExecutionFilePath; }
  68. }
  69. public override HttpBrowserCapabilitiesBase Browser {
  70. get { return new HttpBrowserCapabilitiesWrapper (w.Browser); }
  71. }
  72. public override HttpClientCertificate ClientCertificate {
  73. get { return w.ClientCertificate; }
  74. }
  75. public override Encoding ContentEncoding {
  76. get { return w.ContentEncoding; }
  77. set { w.ContentEncoding = value; }
  78. }
  79. public override int ContentLength {
  80. get { return w.ContentLength; }
  81. }
  82. public override string ContentType {
  83. get { return w.ContentType; }
  84. set { w.ContentType = value; }
  85. }
  86. public override HttpCookieCollection Cookies {
  87. get { return w.Cookies; }
  88. }
  89. public override string CurrentExecutionFilePath {
  90. get { return w.CurrentExecutionFilePath; }
  91. }
  92. public override string FilePath {
  93. get { return w.FilePath; }
  94. }
  95. public override HttpFileCollectionBase Files {
  96. get { return new HttpFileCollectionWrapper (w.Files); }
  97. }
  98. public override Stream Filter {
  99. get { return w.Filter; }
  100. set { w.Filter = value; }
  101. }
  102. public override NameValueCollection Form {
  103. get { return w.Form; }
  104. }
  105. public override NameValueCollection Headers {
  106. get { return w.Headers; }
  107. }
  108. public override string HttpMethod {
  109. get { return w.HttpMethod; }
  110. }
  111. public override Stream InputStream {
  112. get { return w.InputStream; }
  113. }
  114. public override bool IsAuthenticated {
  115. get { return w.IsAuthenticated; }
  116. }
  117. public override bool IsLocal {
  118. get { return w.IsLocal; }
  119. }
  120. public override bool IsSecureConnection {
  121. get { return w.IsSecureConnection; }
  122. }
  123. public override string this [string key] {
  124. get { return w [key]; }
  125. }
  126. public override WindowsIdentity LogonUserIdentity {
  127. get { return w.LogonUserIdentity; }
  128. }
  129. public override NameValueCollection Params {
  130. get { return w.Params; }
  131. }
  132. public override string Path {
  133. get { return w.Path; }
  134. }
  135. public override string PathInfo {
  136. get { return w.PathInfo; }
  137. }
  138. public override string PhysicalApplicationPath {
  139. get { return w.PhysicalApplicationPath; }
  140. }
  141. public override string PhysicalPath {
  142. get { return w.PhysicalPath; }
  143. }
  144. public override NameValueCollection QueryString {
  145. get { return w.QueryString; }
  146. }
  147. public override string RawUrl {
  148. get { return w.RawUrl; }
  149. }
  150. public override string RequestType {
  151. get { return w.RequestType; }
  152. set { w.RequestType = value; }
  153. }
  154. public override NameValueCollection ServerVariables {
  155. get { return w.ServerVariables; }
  156. }
  157. public override int TotalBytes {
  158. get { return w.TotalBytes; }
  159. }
  160. public override Uri Url {
  161. get { return w.Url; }
  162. }
  163. public override Uri UrlReferrer {
  164. get { return w.UrlReferrer; }
  165. }
  166. public override string UserAgent {
  167. get { return w.UserAgent; }
  168. }
  169. public override string UserHostAddress {
  170. get { return w.UserHostAddress; }
  171. }
  172. public override string UserHostName {
  173. get { return w.UserHostName; }
  174. }
  175. public override string [] UserLanguages {
  176. get { return w.UserLanguages; }
  177. }
  178. public override byte [] BinaryRead (int count)
  179. {
  180. return w.BinaryRead (count);
  181. }
  182. public override int [] MapImageCoordinates (string imageFieldName)
  183. {
  184. return w.MapImageCoordinates (imageFieldName);
  185. }
  186. public override string MapPath (string overridePath)
  187. {
  188. return w.MapPath (overridePath);
  189. }
  190. public override string MapPath (string overridePath, string baseVirtualDir, bool allowCrossAppMapping)
  191. {
  192. return w.MapPath (overridePath, baseVirtualDir, allowCrossAppMapping);
  193. }
  194. public override void SaveAs (string filename, bool includeHeaders)
  195. {
  196. w.SaveAs (filename, includeHeaders);
  197. }
  198. public override void ValidateInput ()
  199. {
  200. w.ValidateInput ();
  201. }
  202. }
  203. }