[AspNetHostingPermission (SecurityAction.InheritanceDemand, Level = AspNetHostingPermissionLevel.Minimal)]
public class RootBuilder : TemplateBuilder {
- private Hashtable built_objects;
+ Hashtable built_objects;
public RootBuilder ()
{
public RootBuilder (TemplateParser parser)
{
foundry = new AspComponentFoundry ();
- line = 1;
+ Line = 1;
if (parser != null)
- fileName = parser.InputFile;
+ FileName = parser.InputFile;
Init (parser, null, null, null, null, null);
}
if (tagName == null)
throw new ArgumentNullException ("tagName");
- string prefix;
- string cname;
- int colon = tagName.IndexOf (':');
- if (colon != -1) {
- if (colon == 0)
- throw new Exception ("Empty TagPrefix is not valid");
-
- if (colon + 1 == tagName.Length)
- return null;
-
- prefix = tagName.Substring (0, colon);
- cname = tagName.Substring (colon + 1);
- } else {
- prefix = "";
- cname = tagName;
- }
-
- Type t = foundry.GetComponentType (prefix, cname);
- if (t != null)
- return t;
- else if (prefix != "")
- throw new Exception ("TagPrefix " + prefix + " not registered");
+ AspComponent component = foundry.GetComponent (tagName);
+
+ if (component != null) {
+#if NET_2_0
+ if (!String.IsNullOrEmpty (component.Source)) {
+ TemplateParser parser = Parser;
+
+ if (component.FromConfig) {
+ string parserDir = parser.BaseVirtualDir;
+ VirtualPath vp = new VirtualPath (component.Source);
+
+ if (parserDir == vp.Directory)
+ throw new ParseException (parser.Location,
+ String.Format ("The page '{0}' cannot use the user control '{1}', because it is registered in web.config and lives in the same directory as the page.", parser.VirtualPath, vp.Absolute));
+
+ Parser.AddDependency (component.Source);
+ }
+ }
+#endif
+ return component.Type;
+ } else if (component != null && component.Prefix != String.Empty)
+ throw new Exception ("Unknown server tag '" + tagName + "'");
return LookupHtmlControls (tagName, attribs);
}
internal AspComponentFoundry Foundry {
get { return foundry; }
+ set {
+ if (value is AspComponentFoundry)
+ foundry = value;
+ }
}
#if NET_2_0
// FIXME: it's empty (but not null) when using the new default ctor