private void GetAppStateByParsingGlobalAsax() { using (new ApplicationImpersonationContext()) { if (FileUtil.FileExists(this._appFilename)) { ApplicationFileParser parser = new ApplicationFileParser(); AssemblySet referencedAssemblies = Util.GetReferencedAssemblies(this._theApplicationType.Assembly); referencedAssemblies.Add(typeof(string).Assembly); VirtualPath virtualPath = HttpRuntime.AppDomainAppVirtualPathObject.SimpleCombine("global.asax"); parser.Parse(referencedAssemblies, virtualPath); this._state = new HttpApplicationState(parser.ApplicationObjects, parser.SessionObjects); } } }
private void GetAppStateByParsingGlobalAsax() { using (new ApplicationImpersonationContext()) { // It may not exist if the app is precompiled if (FileUtil.FileExists(_appFilename)) { ApplicationFileParser parser; parser = new ApplicationFileParser(); AssemblySet referencedAssemblies = System.Web.UI.Util.GetReferencedAssemblies( _theApplicationType.Assembly); referencedAssemblies.Add(typeof(string).Assembly); VirtualPath virtualPath = HttpRuntime.AppDomainAppVirtualPathObject.SimpleCombine( applicationFileName); parser.Parse(referencedAssemblies, virtualPath); // Create app state _state = new HttpApplicationState(parser.ApplicationObjects, parser.SessionObjects); } } }