public static VirtualFile GetServiceFile(string normalizedVirtualPath)
        {
            AspNetPartialTrustHelpers.FailIfInPartialTrustOutsideAspNet();

            IDisposable unsafeImpersonate = null;

            try
            {
                try
                {
                    try
                    {
                    }
                    finally
                    {
                        unsafeImpersonate = HostingEnvironmentWrapper.UnsafeImpersonate();
                    }
                    return(HostingEnvironment.VirtualPathProvider.GetFile(normalizedVirtualPath));
                }
                finally
                {
                    if (null != unsafeImpersonate)
                    {
                        unsafeImpersonate.Dispose();
                    }
                }
            }
            catch
            {
                throw;
            }
        }
 public static string MapPath(string virtualPath)
 {
     AspNetPartialTrustHelpers.FailIfInPartialTrustOutsideAspNet();
     return(HostingEnvironment.MapPath(virtualPath));
 }
 public static void IncrementBusyCount()
 {
     AspNetPartialTrustHelpers.FailIfInPartialTrustOutsideAspNet();
     HostingEnvironment.IncrementBusyCount();
 }
 // demands SecurityPermission(Unrestricted) -- use Unsafe version to assert
 public static IDisposable Impersonate(IntPtr token)
 {
     AspNetPartialTrustHelpers.FailIfInPartialTrustOutsideAspNet();
     return(HostingEnvironment.Impersonate(token));
 }
 public static void UnsafeUnregisterObject(IRegisteredObject target)
 {
     AspNetPartialTrustHelpers.FailIfInPartialTrustOutsideAspNet();
     HostingEnvironment.UnregisterObject(target);
 }