2 // HttpContextWrapper.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.Globalization;
34 using System.Runtime.CompilerServices;
35 using System.Security.Permissions;
36 using System.Security.Principal;
37 using System.Web.Caching;
38 using System.Web.Profile;
43 [TypeForwardedFrom ("System.Web.Abstractions, Version=3.5.0.0, Culture=Neutral, PublicKeyToken=31bf3856ad364e35")]
45 [AspNetHostingPermission (SecurityAction.LinkDemand, Level = AspNetHostingPermissionLevel.Minimal)]
46 [AspNetHostingPermission (SecurityAction.InheritanceDemand, Level = AspNetHostingPermissionLevel.Minimal)]
47 public class HttpContextWrapper : HttpContextBase
51 public HttpContextWrapper (HttpContext httpContext)
53 if (httpContext == null)
54 throw new ArgumentNullException ("httpContext");
58 public override Exception [] AllErrors {
59 get { return w.AllErrors; }
62 public override HttpApplicationStateBase Application {
63 get { return new HttpApplicationStateWrapper (w.Application); }
66 public override HttpApplication ApplicationInstance {
67 get { return w.ApplicationInstance; }
68 set { w.ApplicationInstance = value; }
71 public override Cache Cache {
72 get { return w.Cache; }
75 public override IHttpHandler CurrentHandler {
76 get { return w.CurrentHandler; }
79 public override RequestNotification CurrentNotification {
80 get { return w.CurrentNotification; }
83 public override Exception Error {
84 get { return w.Error; }
87 public override IHttpHandler Handler {
88 get { return w.Handler; }
89 set { w.Handler = value; }
92 public override bool IsCustomErrorEnabled {
93 get { return w.IsCustomErrorEnabled; }
96 public override bool IsDebuggingEnabled {
97 get { return w.IsDebuggingEnabled; }
100 public override bool IsPostNotification {
101 get { return w.IsPostNotification; }
104 public override IDictionary Items {
105 get { return w.Items; }
108 public override IHttpHandler PreviousHandler {
109 get { return w.PreviousHandler; }
112 public override ProfileBase Profile {
113 get { return w.Profile; }
116 public override HttpRequestBase Request {
117 get { return new HttpRequestWrapper (w.Request); }
120 public override HttpResponseBase Response {
121 get { return new HttpResponseWrapper (w.Response); }
124 public override HttpServerUtilityBase Server {
125 get { return new HttpServerUtilityWrapper (w.Server); }
128 public override HttpSessionStateBase Session {
129 get { return new HttpSessionStateWrapper (w.Session); }
132 public override bool SkipAuthorization {
133 get { return w.SkipAuthorization; }
134 set { w.SkipAuthorization = value; }
137 public override DateTime Timestamp {
138 get { return w.Timestamp; }
141 public override TraceContext Trace {
142 get { return w.Trace; }
145 public override IPrincipal User {
146 get { return w.User; }
147 set { w.User = value; }
150 public override void AddError (Exception errorInfo)
152 w.AddError (errorInfo);
155 public override void ClearError ()
160 public override object GetGlobalResourceObject (string classKey, string resourceKey)
162 return HttpContext.GetGlobalResourceObject (classKey, resourceKey);
165 public override object GetGlobalResourceObject (string classKey, string resourceKey, CultureInfo culture)
167 return HttpContext.GetGlobalResourceObject (classKey, resourceKey, culture);
170 public override object GetLocalResourceObject (string overridePath, string resourceKey)
172 return HttpContext.GetLocalResourceObject (overridePath, resourceKey);
175 public override object GetLocalResourceObject (string overridePath, string resourceKey, CultureInfo culture)
177 return HttpContext.GetLocalResourceObject (overridePath, resourceKey, culture);
180 public override object GetSection (string sectionName)
182 return w.GetSection (sectionName);
186 public override object GetService (Type serviceType)
188 throw new NotImplementedException ();
191 public override void RewritePath (string path)
193 w.RewritePath (path);
196 public override void RewritePath (string path, bool rebaseClientPath)
198 w.RewritePath (path, rebaseClientPath);
201 public override void RewritePath (string filePath, string pathInfo, string queryString)
203 w.RewritePath (filePath, pathInfo, queryString);
206 public override void RewritePath (string filePath, string pathInfo, string queryString, bool setClientFilePath)
208 w.RewritePath (filePath, pathInfo, queryString, setClientFilePath);