diff options
author | Gonzalo Paniagua Javier <gonzalo.mono@gmail.com> | 2003-10-22 16:06:00 +0400 |
---|---|---|
committer | Gonzalo Paniagua Javier <gonzalo.mono@gmail.com> | 2003-10-22 16:06:00 +0400 |
commit | cab270a6d24d2541541777b9bece8f0da8730289 (patch) | |
tree | 7e65bbf9e2a44c9387267726237d91a3e99cfc8e | |
parent | 792311e5fcaf9cd888a8a1829f254552a28fc347 (diff) |
2003-10-22 Gonzalo Paniagua Javier <gonzalo@ximian.com>
* System.Web/HttpApplication.cs: added AssemblyLocation property.
* System.Web.UI/DesignTimeTemplateParser.cs: added FIXME related to
PageParser.
* System.Web.UI/PageParser.cs: initialize the parser in the constructor,
not just before compiling and reference the application assembly.
* System.Web.UI/SimpleWebHandlerParser.cs: reference the assembly that
contains the application Type.
* System.Web.UI/TemplateControl.cs:
* System.Web.UI/TemplateControlParser.cs: fix BenM #1 bug. Now we pass
correct virtual path and physical path when compiling a user control.
* System.Web.UI/TemplateParser.cs: new AddApplicationAssembly ().
* System.Web.UI/UserControlParser.cs: now we get valid values in the
ctor.
Referencing the application assembly fixes bug #49652.
svn path=/trunk/mcs/; revision=19299
10 files changed, 69 insertions, 11 deletions
diff --git a/mcs/class/System.Web/System.Web.UI/ChangeLog b/mcs/class/System.Web/System.Web.UI/ChangeLog index d4b7d0d7ffb..de05d6a1f74 100644 --- a/mcs/class/System.Web/System.Web.UI/ChangeLog +++ b/mcs/class/System.Web/System.Web.UI/ChangeLog @@ -1,3 +1,23 @@ +2003-10-22 Gonzalo Paniagua Javier <gonzalo@ximian.com> + + * DesignTimeTemplateParser.cs: added FIXME related to PageParser. + + * PageParser.cs: initialize the parser in the constructor, not just before + compiling and reference the application assembly. + + * SimpleWebHandlerParser.cs: reference the assembly that contains the + application Type. + + * TemplateControl.cs: + * TemplateControlParser.cs: fix BenM #1 bug. Now we pass correct virtual + path and physical path when compiling a user control. + + * TemplateParser.cs: new AddApplicationAssembly (). + * UserControlParser.cs: now we get valid values in the ctor. + + Referencing the application assembly fixes bug #49652. + + 2003-10-18 Gonzalo Paniagua Javier <gonzalo@ximian.com> * TemplateControl.cs: moved NoParamsInvoker class to its own file. diff --git a/mcs/class/System.Web/System.Web.UI/DesignTimeTemplateParser.cs b/mcs/class/System.Web/System.Web.UI/DesignTimeTemplateParser.cs index 77b2a45df7b..ff8ece183e5 100644 --- a/mcs/class/System.Web/System.Web.UI/DesignTimeTemplateParser.cs +++ b/mcs/class/System.Web/System.Web.UI/DesignTimeTemplateParser.cs @@ -41,7 +41,7 @@ namespace System.Web.UI private static TemplateParser InitParser (DesignTimeParseData data) { // TODO create the parser and set data - TemplateParser NewParser = new PageParser(); + TemplateParser NewParser = new PageParser(); // see FIXME in PageParser // = data.DesignerHost; // = data.DataBindingHandler; // = data.ParseText; diff --git a/mcs/class/System.Web/System.Web.UI/PageParser.cs b/mcs/class/System.Web/System.Web.UI/PageParser.cs index 0918b533e29..fc86bc47c50 100644 --- a/mcs/class/System.Web/System.Web.UI/PageParser.cs +++ b/mcs/class/System.Web/System.Web.UI/PageParser.cs @@ -10,6 +10,7 @@ using System; using System.Collections; using System.Web; using System.Web.Compilation; +using System.Web.Util; namespace System.Web.UI { @@ -18,12 +19,25 @@ namespace System.Web.UI bool enableSessionState = true; bool readonlySessionState; + // FIXME: this is here just for DesignTimeTemplateParser. Anything to do? + internal PageParser () + { + } + + internal PageParser (string virtualPath, string inputFile, HttpContext context) + { + Context = context; + BaseVirtualDir = UrlUtils.GetDirectory (virtualPath); + InputFile = inputFile; + AddApplicationAssembly (); + } + public static IHttpHandler GetCompiledPageInstance (string virtualPath, string inputFile, HttpContext context) { - PageParser pp = new PageParser (); - IHttpHandler h = (IHttpHandler) pp.GetCompiledInstance (virtualPath, inputFile, context); + PageParser pp = new PageParser (virtualPath, inputFile, context); + IHttpHandler h = (IHttpHandler) pp.GetCompiledInstance (); return h; } diff --git a/mcs/class/System.Web/System.Web.UI/SimpleWebHandlerParser.cs b/mcs/class/System.Web/System.Web.UI/SimpleWebHandlerParser.cs index db88ac238f0..9a14eb25489 100644 --- a/mcs/class/System.Web/System.Web.UI/SimpleWebHandlerParser.cs +++ b/mcs/class/System.Web/System.Web.UI/SimpleWebHandlerParser.cs @@ -47,6 +47,10 @@ namespace System.Web.UI AddDependency (physicalPath); assemblies = new ArrayList (); + string location = Context.ApplicationInstance.AssemblyLocation; + if (location != typeof (TemplateParser).Assembly.Location) + assemblies.Add (location); + assemblies.AddRange (CompilationConfig.Assemblies); if (CompilationConfig.AssembliesInBin) AddAssembliesInBin (); diff --git a/mcs/class/System.Web/System.Web.UI/TemplateControl.cs b/mcs/class/System.Web/System.Web.UI/TemplateControl.cs index 65c75147c16..937eb299ba1 100755 --- a/mcs/class/System.Web/System.Web.UI/TemplateControl.cs +++ b/mcs/class/System.Web/System.Web.UI/TemplateControl.cs @@ -122,7 +122,9 @@ namespace System.Web.UI { if (virtualPath == null) throw new ArgumentNullException ("virtualPath"); - return UserControlParser.GetCompiledType (TemplateSourceDirectory, virtualPath, Context); + string vpath = UrlUtils.Combine (TemplateSourceDirectory, virtualPath); + string realpath = Context.Request.MapPath (vpath); + return UserControlParser.GetCompiledType (vpath, realpath, Context); } public Control LoadControl (string virtualPath) diff --git a/mcs/class/System.Web/System.Web.UI/TemplateControlParser.cs b/mcs/class/System.Web/System.Web.UI/TemplateControlParser.cs index a31b3386383..9110c684163 100644 --- a/mcs/class/System.Web/System.Web.UI/TemplateControlParser.cs +++ b/mcs/class/System.Web/System.Web.UI/TemplateControlParser.cs @@ -30,10 +30,8 @@ namespace System.Web.UI base.ProcessMainAttributes (atts); } - internal object GetCompiledInstance (string virtualPath, string inputFile, HttpContext context) + internal object GetCompiledInstance () { - Context = context; - InputFile = inputFile; Type type = CompileIntoType (); if (type == null) return null; @@ -91,7 +89,10 @@ namespace System.Web.UI } catch (Exception e) { throw new ParseException (Location, e.Message); } - Type type = UserControlParser.GetCompiledType (BaseVirtualDir, src, Context); + + string vpath = UrlUtils.Combine (BaseVirtualDir, src); + string realpath = MapPath (src); + Type type = UserControlParser.GetCompiledType (vpath, realpath, Context); AddAssembly (type.Assembly, true); RootBuilder.Foundry.RegisterFoundry (tagprefix, tagname, type); return; diff --git a/mcs/class/System.Web/System.Web.UI/TemplateParser.cs b/mcs/class/System.Web/System.Web.UI/TemplateParser.cs index aa0d15e6da4..9b1c0d91988 100755 --- a/mcs/class/System.Web/System.Web.UI/TemplateParser.cs +++ b/mcs/class/System.Web/System.Web.UI/TemplateParser.cs @@ -62,6 +62,13 @@ namespace System.Web.UI language = CompilationConfig.DefaultLanguage; } + internal void AddApplicationAssembly () + { + string location = Context.ApplicationInstance.AssemblyLocation; + if (location != typeof (TemplateParser).Assembly.Location) + assemblies.Add (location); + } + protected abstract Type CompileIntoType (); internal virtual void HandleOptions (object obj) diff --git a/mcs/class/System.Web/System.Web.UI/UserControlParser.cs b/mcs/class/System.Web/System.Web.UI/UserControlParser.cs index 11ed81005ff..6a3d73a57dd 100644 --- a/mcs/class/System.Web/System.Web.UI/UserControlParser.cs +++ b/mcs/class/System.Web/System.Web.UI/UserControlParser.cs @@ -19,9 +19,9 @@ namespace System.Web.UI internal UserControlParser (string virtualPath, string inputFile, HttpContext context) { Context = context; - string vp = UrlUtils.Combine (virtualPath, inputFile); - BaseVirtualDir = UrlUtils.GetDirectory (vp); - InputFile = context.Request.MapPath (vp); + BaseVirtualDir = UrlUtils.GetDirectory (virtualPath); + InputFile = inputFile; + AddApplicationAssembly (); } public static Type GetCompiledType (string virtualPath, string inputFile, HttpContext context) diff --git a/mcs/class/System.Web/System.Web/ChangeLog b/mcs/class/System.Web/System.Web/ChangeLog index fd3eaa3c86e..f74cd6c43e3 100644 --- a/mcs/class/System.Web/System.Web/ChangeLog +++ b/mcs/class/System.Web/System.Web/ChangeLog @@ -1,3 +1,7 @@ +2003-10-22 Gonzalo Paniagua Javier <gonzalo@ximian.com> + + * HttpApplication.cs: added AssemblyLocation property. + 2003-10-18 Gonzalo Paniagua Javier <gonzalo@ximian.com> * HttpApplicationFactory.cs: use NoParamsInvoker. diff --git a/mcs/class/System.Web/System.Web/HttpApplication.cs b/mcs/class/System.Web/System.Web/HttpApplication.cs index 71a99a47c39..4bee2ef2cde 100644 --- a/mcs/class/System.Web/System.Web/HttpApplication.cs +++ b/mcs/class/System.Web/System.Web/HttpApplication.cs @@ -709,6 +709,7 @@ namespace System.Web HttpModuleCollection _ModuleCollection; HttpSessionState _Session; HttpApplicationState _appState; + string assemblyLocation; bool _InPreRequestResponseMode; #endregion @@ -717,6 +718,7 @@ namespace System.Web public HttpApplication () { + assemblyLocation = GetType ().Assembly.Location; } #endregion @@ -951,6 +953,10 @@ namespace System.Web #region Properties + internal string AssemblyLocation { + get { return assemblyLocation; } + } + [Browsable (false)] [DesignerSerializationVisibility (DesignerSerializationVisibility.Hidden)] public HttpApplicationState Application { |