private void ParseFile(string physicalPath, VirtualPath virtualPath)
 {
     string o = (physicalPath != null) ? physicalPath : virtualPath.VirtualPathString;
     if (this._circularReferenceChecker.Contains(o))
     {
         throw new HttpException(System.Web.SR.GetString("Circular_include"));
     }
     this._circularReferenceChecker.Add(o);
     try
     {
         TextReader reader;
         if (physicalPath != null)
         {
             using (reader = Util.ReaderFromFile(physicalPath, virtualPath))
             {
                 this.ParseReader(reader);
                 return;
             }
         }
         using (Stream stream = virtualPath.OpenFile())
         {
             reader = Util.ReaderFromStream(stream, virtualPath);
             this.ParseReader(reader);
         }
     }
     finally
     {
         this._circularReferenceChecker.Remove(o);
     }
 }
 private VirtualDirectoryMapping(VirtualPath virtualDirectory, string physicalDirectory, bool isAppRoot, string configFileBaseName)
 {
     this._virtualDirectory = virtualDirectory;
     this._isAppRoot = isAppRoot;
     this.PhysicalDirectory = physicalDirectory;
     this.ConfigFileBaseName = configFileBaseName;
 }
        //
        // GetConfig(context, path) - returns the config at 'path'.
        //
        // This method is more efficient than not using context, as
        // the config cached in the context is used if it matches the
        // context path.
        //
        // For config derived from ConfigurationSection, this will either
        // return a non-null object or throw an exception.
        //
        // For config implemented with IConfigurationSectionHandler, this 
        // may return null, non-null, or throw an exception.
        //
        static internal RuntimeConfig GetConfig(HttpContext context, VirtualPath path) {
            if (!HttpConfigurationSystem.UseHttpConfigurationSystem)  {
                return GetClientRuntimeConfig();
            }

            return context.GetRuntimeConfig(path);
        }
 bool IServerConfig.GetUncUser(IApplicationHost appHost, VirtualPath path, out string username, out string password)
 {
     bool flag = false;
     username = null;
     password = null;
     IntPtr zero = IntPtr.Zero;
     int cchUserName = 0;
     IntPtr bstrPassword = IntPtr.Zero;
     int cchPassword = 0;
     try
     {
         if (UnsafeIISMethods.MgdGetVrPathCreds(IntPtr.Zero, appHost.GetSiteName(), path.VirtualPathString, out zero, out cchUserName, out bstrPassword, out cchPassword) == 0)
         {
             username = (cchUserName > 0) ? StringUtil.StringFromWCharPtr(zero, cchUserName) : null;
             password = (cchPassword > 0) ? StringUtil.StringFromWCharPtr(bstrPassword, cchPassword) : null;
             flag = !string.IsNullOrEmpty(username) && !string.IsNullOrEmpty(password);
         }
     }
     finally
     {
         if (zero != IntPtr.Zero)
         {
             Marshal.FreeBSTR(zero);
         }
         if (bstrPassword != IntPtr.Zero)
         {
             Marshal.FreeBSTR(bstrPassword);
         }
     }
     return flag;
 }
		public ApplicationFileParser (string fname, HttpContext context)
		{
			InputFile = fname;
			Context = context;
			VirtualPath = new VirtualPath ("/" + Path.GetFileName (fname));
			LoadConfigDefaults ();
		}
        internal bool AllowVirtualReference(CompilationSection compConfig, System.Web.VirtualPath referenceVirtualPath)
        {
            VirtualReferenceType page;
            string extension = referenceVirtualPath.Extension;
            Type   type      = CompilationUtil.GetBuildProviderTypeFromExtension(compConfig, extension, BuildProviderAppliesTo.Web, false);

            if (type == null)
            {
                return(false);
            }
            if (type == typeof(PageBuildProvider))
            {
                page = VirtualReferenceType.Page;
            }
            else if (type == typeof(UserControlBuildProvider))
            {
                page = VirtualReferenceType.UserControl;
            }
            else if (type == typeof(MasterPageBuildProvider))
            {
                page = VirtualReferenceType.Master;
            }
            else if (type == typeof(SourceFileBuildProvider))
            {
                page = VirtualReferenceType.SourceFile;
            }
            else
            {
                page = VirtualReferenceType.Other;
            }
            return(this.AllowVirtualReference(referenceVirtualPath.VirtualPathString, page));
        }
Exemple #7
0
        internal Control LoadControl(System.Web.VirtualPath virtualPath)
        {
            virtualPath = System.Web.VirtualPath.Combine(base.TemplateControlVirtualDirectory, virtualPath);
            BuildResult vPathBuildResult = BuildManager.GetVPathBuildResult(this.Context, virtualPath);

            return(this.LoadControl((IWebObjectFactory)vPathBuildResult, virtualPath, null, null));
        }
 private VirtualPath GetAppPathForPathWorker(string siteID, VirtualPath path)
 {
     string str;
     uint result = 0;
     if (!uint.TryParse(siteID, out result))
     {
         return VirtualPath.RootVirtualPath;
     }
     IntPtr zero = IntPtr.Zero;
     int cchPath = 0;
     try
     {
         str = ((UnsafeIISMethods.MgdGetAppPathForPath(IntPtr.Zero, result, path.VirtualPathString, out zero, out cchPath) == 0) && (cchPath > 0)) ? StringUtil.StringFromWCharPtr(zero, cchPath) : null;
     }
     finally
     {
         if (zero != IntPtr.Zero)
         {
             Marshal.FreeBSTR(zero);
         }
     }
     if (str == null)
     {
         return VirtualPath.RootVirtualPath;
     }
     return VirtualPath.Create(str);
 }
 internal CodeBlockBuilder(CodeBlockType blockType, string content, int lineNumber, int column, VirtualPath virtualPath)
 {
     this._content = content;
     this._blockType = blockType;
     this._column = column;
     base.Line = lineNumber;
     base.VirtualPath = virtualPath;
 }
 internal void AddSourceDependency(VirtualPath fileName)
 {
     if (this._sourceDependencies == null)
     {
         this._sourceDependencies = new CaseInsensitiveStringSet();
     }
     this._sourceDependencies.Add(fileName.VirtualPathString);
 }
 internal CachedPathData(string configPath, VirtualPath virtualPath, string physicalPath, bool exists)
 {
     this._configPath = configPath;
     this._virtualPath = virtualPath;
     this._physicalPath = physicalPath;
     this._flags[4] = exists;
     string schemeDelimiter = Uri.SchemeDelimiter;
 }
		internal MasterPageParser (VirtualPath virtualPath, string inputFile, TextReader reader, HttpContext context)
			: base (virtualPath, inputFile, reader, context)
		{
			this.cacheEntryName = String.Concat ("@@MasterPagePHIDS:", virtualPath, ":", InputFile);
			
			contentPlaceHolderIds = HttpRuntime.InternalCache.Get (this.cacheEntryName) as List <string>;
			LoadConfigDefaults ();
		}
 protected void AddDependency(VirtualPath virtualPath)
 {
     virtualPath = base.ResolveVirtualPath(virtualPath);
     if (this._virtualPathDependencies == null)
     {
         this._virtualPathDependencies = new CaseInsensitiveStringSet();
     }
     this._virtualPathDependencies.Add(virtualPath.VirtualPathString);
 }
 internal static VirtualPath CombineVirtualPathsInternal(VirtualPath basePath, VirtualPath relativePath)
 {
     VirtualPathProvider virtualPathProvider = HostingEnvironment.VirtualPathProvider;
     if (virtualPathProvider != null)
     {
         return virtualPathProvider.CombineVirtualPaths(basePath, relativePath);
     }
     return basePath.Parent.Combine(relativePath);
 }
		public BuildManagerDirectoryBuilder (VirtualPath virtualPath)
		{
			if (virtualPath == null)
				throw new ArgumentNullException ("virtualPath");

			this.vpp = HostingEnvironment.VirtualPathProvider;
			this.virtualPath = virtualPath;
			this.virtualPathDirectory = VirtualPathUtility.GetDirectory (virtualPath.Absolute);
		}
 internal static bool IsUserAllowedToPath(HttpContext context, VirtualPath virtualPath)
 {
     AuthorizationSection authorization = RuntimeConfig.GetConfig(context, virtualPath).Authorization;
     if (!authorization.EveryoneAllowed)
     {
         return authorization.IsUserAllowed(context.User, context.Request.RequestType);
     }
     return true;
 }
        internal static PageParserFilter Create(PagesSection pagesConfig, System.Web.VirtualPath virtualPath, TemplateParser parser)
        {
            PageParserFilter filter = pagesConfig.CreateControlTypeFilter();

            if (filter != null)
            {
                filter.InitializeInternal(virtualPath, parser);
            }
            return(filter);
        }
 internal void InitializeInternal(System.Web.VirtualPath virtualPath, TemplateParser parser)
 {
     this._parser      = parser;
     this._virtualPath = virtualPath;
     this.Initialize();
     this._numberOfControlsAllowed   = this.NumberOfControlsAllowed;
     this._dependenciesAllowed       = this.TotalNumberOfDependenciesAllowed + 1;
     this._directDependenciesAllowed = this.NumberOfDirectDependenciesAllowed + 1;
     this.CalledFromParseControl     = parser.flags[0x4000000];
 }
Exemple #19
0
		internal UserControlParser (VirtualPath virtualPath, string inputFile, HttpContext context, string type)
		{
			VirtualPath = virtualPath;
			Context = context;
			BaseVirtualDir = virtualPath.DirectoryNoNormalize;
			InputFile = inputFile;
			SetBaseType (type);
			AddApplicationAssembly ();
			LoadConfigDefaults ();
		}
 internal override string ComputeSourceDependenciesHashCode(VirtualPath virtualPath)
 {
     if (virtualPath == null)
     {
         virtualPath = base.VirtualPath;
     }
     HashCodeCombiner combiner = new HashCodeCombiner();
     combiner.AddResourcesDirectory(virtualPath.MapPathInternal());
     return combiner.CombinedHashString;
 }
 internal static object AddVirtualPathToFileMapping(VirtualPath virtualPath, string physicalPath)
 {
     CallContext.SetData(GetFixedMappingSlotName(virtualPath), physicalPath);
     VirtualPathToFileMappingState state = new VirtualPathToFileMappingState {
         VirtualPath = virtualPath,
         VirtualPathProvider = _theHostingEnvironment._virtualPathProvider
     };
     _theHostingEnvironment._virtualPathProvider = _theHostingEnvironment._mapPathBasedVirtualPathProvider;
     return state;
 }
 internal Type GetReferencedType(VirtualPath virtualPath, bool allowNoCompile)
 {
     virtualPath = base.ResolveVirtualPath(virtualPath);
     if ((base._pageParserFilter != null) && !base._pageParserFilter.AllowVirtualReference(base.CompConfig, virtualPath))
     {
         base.ProcessError(System.Web.SR.GetString("Reference_not_allowed", new object[] { virtualPath }));
     }
     BuildResult vPathBuildResult = null;
     Type baseType = null;
     try
     {
         vPathBuildResult = BuildManager.GetVPathBuildResult(virtualPath);
     }
     catch (HttpCompileException exception)
     {
         if (exception.VirtualPathDependencies != null)
         {
             foreach (string str in exception.VirtualPathDependencies)
             {
                 base.AddSourceDependency(VirtualPath.Create(str));
             }
         }
         throw;
     }
     catch
     {
         if (this.IgnoreParseErrors)
         {
             base.AddSourceDependency(virtualPath);
         }
         throw;
     }
     BuildResultNoCompileTemplateControl control = vPathBuildResult as BuildResultNoCompileTemplateControl;
     if (control != null)
     {
         if (!allowNoCompile)
         {
             return null;
         }
         baseType = control.BaseType;
     }
     else
     {
         if (!(vPathBuildResult is BuildResultCompiledType))
         {
             throw new HttpException(System.Web.SR.GetString("Invalid_typeless_reference", new object[] { "src" }));
         }
         BuildResultCompiledType type2 = (BuildResultCompiledType) vPathBuildResult;
         baseType = type2.ResultType;
     }
     base.AddTypeDependency(baseType);
     base.AddBuildResultDependency(vPathBuildResult);
     return baseType;
 }
 internal virtual string ComputeSourceDependenciesHashCode(System.Web.VirtualPath virtualPath)
 {
     if (this.VirtualPathDependencies == null)
     {
         return(string.Empty);
     }
     if (virtualPath == null)
     {
         virtualPath = this.VirtualPath;
     }
     return(virtualPath.GetFileHash(this.VirtualPathDependencies));
 }
 private void GetPathConfigFilenameWorker(string siteID, VirtualPath path, out string directory, out string baseName)
 {
     directory = this.MapPathCaching(siteID, path);
     if (directory != null)
     {
         baseName = "web.config";
     }
     else
     {
         baseName = null;
     }
 }
        /*
         * Return a CompilerType that a file name's extension maps to.
         */
        internal static CompilerType GetCompilerInfoFromVirtualPath(VirtualPath virtualPath) {

            // Get the extension of the source file to compile
            string extension = virtualPath.Extension;

            // Make sure there is an extension
            if (extension.Length == 0) {
                throw new HttpException(
                    SR.GetString(SR.Empty_extension, virtualPath));
            }

            return GetCompilerInfoFromExtension(virtualPath, extension);
        }
 internal SimpleApplicationHost(VirtualPath virtualPath, string physicalPath)
 {
     if (string.IsNullOrEmpty(physicalPath))
     {
         throw ExceptionUtil.ParameterNullOrEmpty("physicalPath");
     }
     if (FileUtil.IsSuspiciousPhysicalPath(physicalPath))
     {
         throw ExceptionUtil.ParameterInvalid(physicalPath);
     }
     this._appVirtualPath = virtualPath;
     this._appPhysicalPath = StringUtil.StringEndsWith(physicalPath, @"\") ? physicalPath : (physicalPath + @"\");
 }
 internal HttpHandlerAction FindMapping(string verb, VirtualPath path)
 {
     this.ValidateHandlers();
     for (int i = 0; i < this.Handlers.Count; i++)
     {
         HttpHandlerAction action = this.Handlers[i];
         if (action.IsMatch(verb, path))
         {
             return action;
         }
     }
     return null;
 }
 private VirtualPath GetAppPathForPath(string siteID, VirtualPath path)
 {
     if (!this.IsSiteMatch(siteID))
     {
         return null;
     }
     VirtualDirectoryMapping pathMapping = this.GetPathMapping(path, true);
     if (pathMapping == null)
     {
         return null;
     }
     return pathMapping.VirtualDirectoryObject;
 }
        internal static ExpressionBuilder GetExpressionBuilder(string expressionPrefix, VirtualPath virtualPath, IDesignerHost host) {
            // If there is no expressionPrefix, it's a v1 style databinding expression
            if (expressionPrefix.Length == 0) {
                if (dataBindingExpressionBuilder == null) {
                    dataBindingExpressionBuilder = new DataBindingExpressionBuilder();
                }
                return dataBindingExpressionBuilder;
            }

            CompilationSection config = null;

            // If we are in the designer, we need to access IWebApplication config instead
#if !FEATURE_PAL // FEATURE_PAL does not support designer-based features
            if (host != null) {
                IWebApplication webapp = (IWebApplication)host.GetService(typeof(IWebApplication));
                if (webapp != null) {
                    config = webapp.OpenWebConfiguration(true).GetSection("system.web/compilation") as CompilationSection;
                }
            }
#endif // !FEATURE_PAL

            // If we failed to get config from the designer, fall back on runtime config always
            if (config == null) {
                config = MTConfigUtil.GetCompilationConfig(virtualPath);
            }

            System.Web.Configuration.ExpressionBuilder builder = config.ExpressionBuilders[expressionPrefix];
            if (builder == null) {
                throw new HttpParseException(SR.GetString(SR.InvalidExpressionPrefix, expressionPrefix));
            }

            Type expressionBuilderType = null;
            if (host != null) {
                // If we are in the designer, we have to use the type resolution service
                ITypeResolutionService ts = (ITypeResolutionService)host.GetService(typeof(ITypeResolutionService));
                if (ts != null) {
                    expressionBuilderType = ts.GetType(builder.Type);
                }
            }
            if (expressionBuilderType == null) {
                expressionBuilderType = builder.TypeInternal;
            }
            Debug.Assert(expressionBuilderType != null, "expressionBuilderType should not be null");

            if (!typeof(ExpressionBuilder).IsAssignableFrom(expressionBuilderType)) {
                throw new HttpParseException(SR.GetString(SR.ExpressionBuilder_InvalidType, expressionBuilderType.FullName));
            }
            ExpressionBuilder expressionBuilder = (ExpressionBuilder)HttpRuntime.FastCreatePublicInstance(expressionBuilderType);

            return expressionBuilder;
        }
 internal static MasterPage CreateMaster(TemplateControl owner, HttpContext context, VirtualPath masterPageFile, IDictionary contentTemplateCollection)
 {
     MasterPage child = null;
     if (masterPageFile == null)
     {
         if ((contentTemplateCollection != null) && (contentTemplateCollection.Count > 0))
         {
             throw new HttpException(System.Web.SR.GetString("Content_only_allowed_in_content_page"));
         }
         return null;
     }
     VirtualPath virtualPath = VirtualPathProvider.CombineVirtualPathsInternal(owner.TemplateControlVirtualPath, masterPageFile);
     ITypedWebObjectFactory vPathBuildResult = (ITypedWebObjectFactory) BuildManager.GetVPathBuildResult(context, virtualPath);
     if (!typeof(MasterPage).IsAssignableFrom(vPathBuildResult.InstantiatedType))
     {
         throw new HttpException(System.Web.SR.GetString("Invalid_master_base", new object[] { masterPageFile }));
     }
     child = (MasterPage) vPathBuildResult.CreateInstance();
     child.TemplateControlVirtualPath = virtualPath;
     if (owner.HasControls())
     {
         foreach (Control control in owner.Controls)
         {
             LiteralControl control2 = control as LiteralControl;
             if ((control2 == null) || (System.Web.UI.Util.FirstNonWhiteSpaceIndex(control2.Text) >= 0))
             {
                 throw new HttpException(System.Web.SR.GetString("Content_allowed_in_top_level_only"));
             }
         }
         owner.Controls.Clear();
     }
     if (owner.Controls.IsReadOnly)
     {
         throw new HttpException(System.Web.SR.GetString("MasterPage_Cannot_ApplyTo_ReadOnly_Collection"));
     }
     if (contentTemplateCollection != null)
     {
         foreach (string str in contentTemplateCollection.Keys)
         {
             if (!child.ContentPlaceHolders.Contains(str.ToLower(CultureInfo.InvariantCulture)))
             {
                 throw new HttpException(System.Web.SR.GetString("MasterPage_doesnt_have_contentplaceholder", new object[] { str, masterPageFile }));
             }
         }
         child._contentTemplates = contentTemplateCollection;
     }
     child._ownerControl = owner;
     child.InitializeAsUserControl(owner.Page);
     owner.Controls.Add(child);
     return child;
 }
 internal MapPathBasedVirtualPathEnumerator(VirtualPath virtualPath, RequestedEntryType requestedEntryType)
 {
     string str;
     if (virtualPath.IsRelative)
     {
         throw new ArgumentException(System.Web.SR.GetString("Invalid_app_VirtualPath"), "virtualPath");
     }
     this._virtualPath = virtualPath;
     this._requestedEntryType = requestedEntryType;
     if (!ServerConfig.UseServerConfig)
     {
         str = this._virtualPath.MapPathInternal();
     }
     else
     {
         IServerConfig instance = ServerConfig.GetInstance();
         this._serverConfig2 = instance as IServerConfig2;
         str = instance.MapPath(null, this._virtualPath);
         if (this._requestedEntryType != RequestedEntryType.Files)
         {
             if (this._serverConfig2 == null)
             {
                 string[] strArray = instance.GetVirtualSubdirs(this._virtualPath, false);
                 if (strArray != null)
                 {
                     this._exclude = new Hashtable(StringComparer.OrdinalIgnoreCase);
                     foreach (string str2 in strArray)
                     {
                         this._exclude[str2] = str2;
                     }
                 }
             }
             string[] virtualSubdirs = instance.GetVirtualSubdirs(this._virtualPath, true);
             if (virtualSubdirs != null)
             {
                 this._virtualPaths = new Hashtable(StringComparer.OrdinalIgnoreCase);
                 foreach (string str3 in virtualSubdirs)
                 {
                     VirtualPath path = this._virtualPath.SimpleCombineWithDir(str3);
                     if (FileUtil.DirectoryExists(instance.MapPath(null, path)))
                     {
                         this._virtualPaths[str3] = new MapPathBasedVirtualDirectory(path.VirtualPathString);
                     }
                 }
                 this._virtualEnumerator = this._virtualPaths.Values.GetEnumerator();
             }
         }
     }
     this._fileEnumerator = FileEnumerator.Create(str);
     this._useFileEnumerator = false;
 }
        internal SimpleApplicationHost(VirtualPath virtualPath, string physicalPath) {

            if (String.IsNullOrEmpty(physicalPath))
                throw ExceptionUtil.ParameterNullOrEmpty("physicalPath");

            // Throw if the physical path is not canonical, to prevent potential
            // security issues (VSWhidbey 418125)
            if (FileUtil.IsSuspiciousPhysicalPath(physicalPath)) {
                throw ExceptionUtil.ParameterInvalid(physicalPath);
            }

            _appVirtualPath = virtualPath;
            _appPhysicalPath = StringUtil.StringEndsWith(physicalPath, "\\") ? physicalPath : physicalPath + "\\";
        }
		internal ApplicationFileParser (VirtualPath virtualPath, string inputFile, TextReader reader, HttpContext context)
		{
			VirtualPath = virtualPath;
			Context = context;
			Reader = reader;

			if (String.IsNullOrEmpty (inputFile))
				InputFile = virtualPath.PhysicalPath;
			else
				InputFile = inputFile;
			
			SetBaseType (null);
			LoadConfigDefaults ();
		}
        internal static CompilerType GetDefaultLanguageCompilerInfo(CompilationSection compConfig, VirtualPath configPath) {
            if (compConfig == null) {
                // Get the <compilation> config object
                compConfig = MTConfigUtil.GetCompilationConfig(configPath);
            }

            // If no default language was specified in config, use VB
            if (compConfig.DefaultLanguage == null) {
                return GetCodeDefaultLanguageCompilerInfo();
            }
            else {
                return compConfig.GetCompilerInfoFromLanguage(compConfig.DefaultLanguage);
            }
        }
        internal ISAPIApplicationHost(string appIdOrVirtualPath, string physicalPath, bool validatePhysicalPath, IProcessHostSupportFunctions functions, string iisVersion = null) {
            _iisVersion = iisVersion;
            // appIdOrVirtualPath is either a full metabase path, or just a virtual path
            // e.g. /LM/W3SVC/1/Root/MyApp ot /MyApp
            // Figure out which one we have, and get the other one from it
            _functions = functions;

            // make sure the functions are set in the default domain
            if (null == _functions) {
                ProcessHost h = ProcessHost.DefaultHost;

                if (null != h) {
                    _functions = h.SupportFunctions;

                    if (null != _functions) {
                        HostingEnvironment.SupportFunctions = _functions;
                    }
                }
            }

            IServerConfig serverConfig = ServerConfig.GetDefaultDomainInstance(_iisVersion);

            if (StringUtil.StringStartsWithIgnoreCase(appIdOrVirtualPath, LMW3SVC_PREFIX)) {
                _appId = appIdOrVirtualPath;
                _virtualPath = VirtualPath.Create(ExtractVPathFromAppId(_appId));
                _siteID = ExtractSiteIdFromAppId(_appId);
                _siteName = serverConfig.GetSiteNameFromSiteID(_siteID);
            }
            else {
                _virtualPath = VirtualPath.Create(appIdOrVirtualPath);
                _appId = GetDefaultAppIdFromVPath(_virtualPath.VirtualPathString);
                _siteID = DEFAULT_SITEID;
                _siteName = serverConfig.GetSiteNameFromSiteID(_siteID);
            }

            // Get the physical path from the virtual path if it wasn't passed in
            if (physicalPath == null) {
                _physicalPath = serverConfig.MapPath(this, _virtualPath);
            }
            else {
                _physicalPath = physicalPath;
            }

            if (validatePhysicalPath) {
                if (!Directory.Exists(_physicalPath)) {
                    throw new HttpException(SR.GetString(SR.Invalid_IIS_app, appIdOrVirtualPath));
                }
            }
        }
 internal bool IsUpToDate(System.Web.VirtualPath virtualPath, bool ensureIsUpToDate)
 {
     if (ensureIsUpToDate)
     {
         string str;
         if (this._lock < 0)
         {
             return(false);
         }
         DateTime now = DateTime.Now;
         if ((now < this._nextUpToDateCheck) && !BuildManagerHost.InClientBuildManager)
         {
             return(true);
         }
         if (Interlocked.CompareExchange(ref this._lock, 1, 0) != 0)
         {
             return(true);
         }
         try
         {
             str = this.ComputeSourceDependenciesHashCode(virtualPath);
         }
         catch
         {
             Interlocked.Exchange(ref this._lock, 0);
             throw;
         }
         if ((str == null) || (str != this._virtualPathDependenciesHash))
         {
             this._lock = -1;
             return(false);
         }
         this._nextUpToDateCheck = now.AddSeconds(2.0);
         Interlocked.Exchange(ref this._lock, 0);
     }
     return(true);
 }
 internal string MapPathInternal(VirtualPath baseVirtualDir, bool allowCrossAppMapping)
 {
     return(HostingEnvironment.MapPathInternal(this, baseVirtualDir, allowCrossAppMapping));
 }
 internal Stream OpenStream(System.Web.VirtualPath virtualPath)
 {
     return(virtualPath.OpenFile());
 }
 internal TextReader OpenReader(System.Web.VirtualPath virtualPath)
 {
     return(Util.ReaderFromStream(this.OpenStream(virtualPath), virtualPath));
 }
 public static bool operator !=(VirtualPath v1, VirtualPath v2)
 {
     return(!VirtualPath.Equals(v1, v2));
 }
Exemple #41
0
 internal ApplicationInfo(string id, System.Web.VirtualPath virtualPath, string physicalPath)
 {
     this._id           = id;
     this._virtualPath  = virtualPath;
     this._physicalPath = physicalPath;
 }
        internal static BuildResult CreateBuildResultFromCode(BuildResultTypeCode code, System.Web.VirtualPath virtualPath)
        {
            BuildResult result = null;

            switch (code)
            {
            case BuildResultTypeCode.BuildResultCompiledAssembly:
                result = new BuildResultCompiledAssembly();
                break;

            case BuildResultTypeCode.BuildResultCompiledType:
                result = new BuildResultCompiledType();
                break;

            case BuildResultTypeCode.BuildResultCompiledTemplateType:
                result = new BuildResultCompiledTemplateType();
                break;

            case BuildResultTypeCode.BuildResultCustomString:
                result = new BuildResultCustomString();
                break;

            case BuildResultTypeCode.BuildResultMainCodeAssembly:
                result = new BuildResultMainCodeAssembly();
                break;

            case BuildResultTypeCode.BuildResultCodeCompileUnit:
                result = new BuildResultCodeCompileUnit();
                break;

            case BuildResultTypeCode.BuildResultCompiledGlobalAsaxType:
                result = new BuildResultCompiledGlobalAsaxType();
                break;

            case BuildResultTypeCode.BuildResultResourceAssembly:
                result = new BuildResultResourceAssembly();
                break;

            default:
                return(null);
            }
            result.VirtualPath        = virtualPath;
            result._nextUpToDateCheck = DateTime.MinValue;
            return(result);
        }
 private static bool EqualsHelper(VirtualPath v1, VirtualPath v2)
 {
     return(StringComparer.InvariantCultureIgnoreCase.Compare(
                v1.VirtualPathString, v2.VirtualPathString) == 0);
 }
Exemple #44
0
        private Control LoadControl(IWebObjectFactory objectFactory, System.Web.VirtualPath virtualPath, Type t, object[] parameters)
        {
            BuildResultCompiledType         type    = null;
            BuildResultNoCompileUserControl control = null;
            PartialCachingAttribute         cachingAttribute;

            if (objectFactory != null)
            {
                type = objectFactory as BuildResultCompiledType;
                if (type != null)
                {
                    t = type.ResultType;
                    Util.CheckAssignableType(typeof(UserControl), t);
                }
                else
                {
                    control = (BuildResultNoCompileUserControl)objectFactory;
                }
            }
            else if (t != null)
            {
                Util.CheckAssignableType(typeof(Control), t);
            }
            if (t != null)
            {
                cachingAttribute = (PartialCachingAttribute)TypeDescriptor.GetAttributes(t)[typeof(PartialCachingAttribute)];
            }
            else
            {
                cachingAttribute = control.CachingAttribute;
            }
            if (cachingAttribute == null)
            {
                Control control2;
                if (objectFactory != null)
                {
                    control2 = (Control)objectFactory.CreateInstance();
                }
                else
                {
                    control2 = (Control)HttpRuntime.CreatePublicInstance(t, parameters);
                }
                UserControl control3 = control2 as UserControl;
                if (control3 != null)
                {
                    if (virtualPath != null)
                    {
                        control3.TemplateControlVirtualPath = virtualPath;
                    }
                    control3.InitializeAsUserControl(this.Page);
                }
                return(control2);
            }
            HashCodeCombiner combinedHashCode = new HashCodeCombiner();

            if (objectFactory != null)
            {
                combinedHashCode.AddObject(objectFactory);
            }
            else
            {
                combinedHashCode.AddObject(t);
            }
            if (!cachingAttribute.Shared)
            {
                this.AddStackContextToHashCode(combinedHashCode);
            }
            string combinedHashString = combinedHashCode.CombinedHashString;

            return(new PartialCachingControl(objectFactory, t, cachingAttribute, "_" + combinedHashString, parameters));
        }
 // Copy a set of flags from another VirtualPath object
 private void CopyFlagsFrom(VirtualPath virtualPath, int mask)
 {
     flags.IntegerValue |= virtualPath.flags.IntegerValue & mask;
 }
Exemple #46
0
 internal ITemplate LoadTemplate(System.Web.VirtualPath virtualPath)
 {
     virtualPath = System.Web.VirtualPath.Combine(base.TemplateControlVirtualDirectory, virtualPath);
     return(new SimpleTemplate((ITypedWebObjectFactory)BuildManager.GetVPathBuildResult(this.Context, virtualPath)));
 }
 internal static string GetVirtualPathString(VirtualPath virtualPath)
 {
     return(virtualPath == null ? null : virtualPath.VirtualPathString);
 }
Exemple #48
0
 internal ExpressionBuilderContext(System.Web.VirtualPath virtualPath)
 {
     this._virtualPath = virtualPath;
 }
Exemple #49
0
 public ExpressionBuilderContext(string virtualPath)
 {
     this._virtualPath = System.Web.VirtualPath.Create(virtualPath);
 }
 internal static string GetVirtualPathStringNoTrailingSlash(VirtualPath virtualPath)
 {
     return(virtualPath == null ? null : virtualPath.VirtualPathStringNoTrailingSlash);
 }
 internal void SetVirtualPath(System.Web.VirtualPath virtualPath)
 {
     this._virtualPath = virtualPath;
 }