HostingEnvironment.cs 4.4 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175
  1. //
  2. // System.Web.Hosting.HostingEnvironment.cs
  3. //
  4. // Author:
  5. // Chris Toshok ([email protected])
  6. // Gonzalo Paniagua Javier ([email protected])
  7. //
  8. //
  9. // Copyright (C) 2005,2006 Novell, Inc (http://www.novell.com)
  10. //
  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:
  18. //
  19. // The above copyright notice and this permission notice shall be
  20. // included in all copies or substantial portions of the Software.
  21. //
  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.
  29. //
  30. #if NET_2_0
  31. using System;
  32. using System.Security.Permissions;
  33. using System.Web.Caching;
  34. namespace System.Web.Hosting {
  35. [AspNetHostingPermission (SecurityAction.Demand, Level = AspNetHostingPermissionLevel.Medium)]
  36. [AspNetHostingPermission (SecurityAction.InheritanceDemand, Level = AspNetHostingPermissionLevel.High)]
  37. public sealed class HostingEnvironment : MarshalByRefObject
  38. {
  39. static bool is_hosted;
  40. static string site_name;
  41. static ApplicationShutdownReason shutdown_reason;
  42. static VirtualPathProvider vpath_provider; // This should get a default
  43. public HostingEnvironment ()
  44. {
  45. }
  46. public static string ApplicationID {
  47. get { return HttpRuntime.AppDomainAppId; }
  48. }
  49. public static string ApplicationPhysicalPath {
  50. get { return HttpRuntime.AppDomainAppPath; }
  51. }
  52. public static string ApplicationVirtualPath {
  53. get { return HttpRuntime.AppDomainAppVirtualPath; }
  54. }
  55. public static Cache Cache {
  56. get { return HttpRuntime.Cache; }
  57. }
  58. public static Exception InitializationException {
  59. get { return HttpApplication.InitializationException; }
  60. }
  61. public static bool IsHosted {
  62. get { return is_hosted; }
  63. }
  64. public static ApplicationShutdownReason ShutdownReason {
  65. get { return shutdown_reason; }
  66. }
  67. [MonoTODO]
  68. public static string SiteName {
  69. get { return site_name; }
  70. }
  71. public static VirtualPathProvider VirtualPathProvider {
  72. get { return vpath_provider; }
  73. }
  74. [MonoTODO]
  75. public static void DecrementBusyCount ()
  76. {
  77. throw new NotImplementedException ();
  78. }
  79. [MonoTODO]
  80. public static IDisposable Impersonate ()
  81. {
  82. throw new NotImplementedException ();
  83. }
  84. [MonoTODO]
  85. public static IDisposable Impersonate (IntPtr token)
  86. {
  87. throw new NotImplementedException ();
  88. }
  89. [MonoTODO]
  90. public static IDisposable Impersonate (IntPtr userToken, string virtualPath)
  91. {
  92. throw new NotImplementedException ();
  93. }
  94. [MonoTODO]
  95. public static void IncrementBusyCount ()
  96. {
  97. throw new NotImplementedException ();
  98. }
  99. public override object InitializeLifetimeService ()
  100. {
  101. return null;
  102. }
  103. [MonoTODO]
  104. public static void InitiateShutdown ()
  105. {
  106. throw new NotImplementedException ();
  107. }
  108. [MonoTODO]
  109. public static string MapPath (string virtualPath)
  110. {
  111. throw new NotImplementedException ();
  112. }
  113. [MonoTODO]
  114. public static void RegisterObject (IRegisteredObject obj)
  115. {
  116. throw new NotImplementedException ();
  117. }
  118. public static void RegisterVirtualPathProvider (VirtualPathProvider virtualPathProvider)
  119. {
  120. if (HttpRuntime.AppDomainAppVirtualPath == null)
  121. throw new InvalidOperationException ();
  122. if (virtualPathProvider == null)
  123. throw new ArgumentNullException ("virtualPathProvider");
  124. virtualPathProvider.SetPrevious (vpath_provider);
  125. vpath_provider = virtualPathProvider;
  126. }
  127. [MonoTODO]
  128. public static IDisposable SetCultures (string virtualPath)
  129. {
  130. throw new NotImplementedException ();
  131. }
  132. [MonoTODO]
  133. public static IDisposable SetCultures ()
  134. {
  135. throw new NotImplementedException ();
  136. }
  137. [MonoTODO]
  138. public static void UnregisterObject (IRegisteredObject obj)
  139. {
  140. throw new NotImplementedException ();
  141. }
  142. }
  143. }
  144. #endif