}
#if NET_2_0
+ internal TSection GetConfigSection <TSection> (string section) where TSection: global::System.Configuration.ConfigurationSection
+ {
+ VirtualPath vpath = VirtualPath;
+ string vp = vpath != null ? vpath.Absolute : null;
+ if (vp == null)
+ return WebConfigurationManager.GetWebApplicationSection (section) as TSection;
+ else
+ return WebConfigurationManager.GetSection (section, vp) as TSection;
+ }
+
+ internal VirtualPath VirtualPath {
+ get;
+ set;
+ }
+
internal CompilationSection CompilationConfig {
- get {
- return WebConfigurationManager.GetWebApplicationSection ("system.web/compilation") as CompilationSection;
- }
+ get { return GetConfigSection <CompilationSection> ("system.web/compilation"); }
}
#else
+2009-04-21 Marek Habersack <mhabersack@novell.com>
+
+ * SimpleWebHandlerParser.cs: retrieve CompilationSection from the
+ appropriate web.config file.
+
+ * BaseParser.cs: moved the internal property VirtualPath from
+ TemplateParser to here and added an internal method
+ GetConfigSection to retrieve sections from the correct web.config
+ file on 2.0 applications. Fixes bug #494245
+
+ * PageParser.cs: use the new GetConfigSection method to retrieve
+ ClientTargetSection.
+
+ * TemplateParser.cs: moved the VirtualPath property to
+ BaseParser.
+ PagesConfig now uses the new GetConfigSection method. Fixes bug
+ #494245
+
2009-04-15 Marek Habersack <mhabersack@novell.com>
* TemplateParser.cs: use generic lists for import, namespace and
if (clientTarget != null) {
clientTarget = clientTarget.Trim ();
#if NET_2_0
- ClientTargetSection sec = (ClientTargetSection)WebConfigurationManager.GetWebApplicationSection ("system.web/clientTarget");
+ ClientTargetSection sec = GetConfigSection <ClientTargetSection> ("system.web/clientTarget");
ClientTarget ct = null;
if ((ct = sec.ClientTargets [clientTarget]) == null)
#if NET_2_0
internal override void AddDirective (string directive, Hashtable atts)
- {
+ {
bool isMasterType = String.Compare ("MasterType", directive, StringComparison.OrdinalIgnoreCase) == 0;
bool isPreviousPageType = isMasterType ? false : String.Compare ("PreviousPageType", directive,
StringComparison.OrdinalIgnoreCase) == 0;
-
+
string typeName = null;
string virtualPath = null;
Type type = null;
#if NET_2_0
CompilationSection CompilationConfig {
get {
- return (CompilationSection)WebConfigurationManager.GetWebApplicationSection ("system.web/compilation");
+ string vp = VirtualPath;
+ if (String.IsNullOrEmpty (vp))
+ return WebConfigurationManager.GetWebApplicationSection ("system.web/compilation") as CompilationSection;
+ else
+ return WebConfigurationManager.GetSection ("system.web/compilation", vp) as CompilationSection;
}
}
if (BuildManager.HaveResources)
imports.Add ("System.Resources");
- PagesSection pages = WebConfigurationManager.GetWebApplicationSection ("system.web/pages") as PagesSection;
+ PagesSection pages = PagesConfig;
if (pages == null)
return;
get {
if (pageParserFilter != null)
return pageParserFilter;
-
+
if (String.IsNullOrEmpty (pageParserFilterTypeName))
return null;
pageParserFilter = Activator.CreateInstance (PageParserFilterType) as PageParserFilter;
pageParserFilter.Initialize (VirtualPath, this);
-
+
return pageParserFilter;
}
}
internal ILocation DirectiveLocation {
get { return directiveLocation; }
}
-
-#if NET_2_0
- internal VirtualPath VirtualPath {
- get;
- set;
- }
-#endif
-
+
internal string ParserDir {
get {
if (includeDirs == null || includeDirs.Count == 0)
}
internal PagesSection PagesConfig {
- get {
- return WebConfigurationManager.GetWebApplicationSection ("system.web/pages") as PagesSection;
- }
+ get { return GetConfigSection <PagesSection> ("system.web/pages") as PagesSection; }
}
internal AspGenerator AspGenerator {