merge -r 58784:58785
[mono.git] / mcs / class / System.Web / System.Web.UI / TemplateParser.cs
index 842b2211491f0212d0cf885da2df25aa43fa8428..8a82aca3bbfad06f20414100410a2327c214b2dd 100644 (file)
@@ -6,8 +6,7 @@
 //     Gonzalo Paniagua Javier (gonzalo@ximian.com)
 //
 // (C) 2002,2003 Ximian, Inc. (http://www.ximian.com)
-//
-
+// Copyright (C) 2005 Novell, Inc (http://www.novell.com)
 //
 // Permission is hereby granted, free of charge, to any person obtaining
 // a copy of this software and associated documentation files (the
 // OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION
 // WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
 //
-using System;
+
 using System.CodeDom.Compiler;
 using System.Collections;
 using System.IO;
 using System.Reflection;
-using System.Web;
+using System.Security.Permissions;
 using System.Web.Compilation;
 using System.Web.Configuration;
 using System.Web.Util;
 
-namespace System.Web.UI
-{
+namespace System.Web.UI {
+
+       // CAS
+       [AspNetHostingPermission (SecurityAction.LinkDemand, Level = AspNetHostingPermissionLevel.Minimal)]
+       [AspNetHostingPermission (SecurityAction.InheritanceDemand, Level = AspNetHostingPermissionLevel.Minimal)]
        public abstract class TemplateParser : BaseParser
        {
                string inputFile;
@@ -409,29 +411,38 @@ namespace System.Web.UI
                internal virtual void ProcessMainAttributes (Hashtable atts)
                {
                        atts.Remove ("Description"); // ignored
+#if NET_1_1
                        atts.Remove ("CodeBehind");  // ignored
-                       atts.Remove ("AspCompat"); // ignored
-
-#if NET_2_0
-                       atts.Remove ("CodeFile"); // ignored
 #endif
+                       atts.Remove ("AspCompat"); // ignored
 
                        debug = GetBool (atts, "Debug", true);
                        compilerOptions = GetString (atts, "CompilerOptions", "");
                        language = GetString (atts, "Language", CompilationConfig.DefaultLanguage);
                        strictOn = GetBool (atts, "Strict", CompilationConfig.Strict);
                        explicitOn = GetBool (atts, "Explicit", CompilationConfig.Explicit);
+#if NET_2_0
+                       string src = GetString (atts, "CodeFile", null);
+#else
                        string src = GetString (atts, "Src", null);
+#endif
                        if (src != null)
                                srcAssembly = GetAssemblyFromSource (src);
 
                        string inherits = GetString (atts, "Inherits", null);
+#if NET_2_0
+                       if (srcAssembly == null)
+                               className = inherits;
+                       else
+                               SetBaseType (inherits);
+#else
                        if (inherits != null)
                                SetBaseType (inherits);
 
                        className = GetString (atts, "ClassName", null);
                        if (className != null && !CodeGenerator.IsValidLanguageIndependentIdentifier (className))
                                ThrowParseException (String.Format ("'{0}' is not valid for 'className'", className));
+#endif
 
                        if (atts.Count > 0)
                                ThrowParseException ("Unknown attribute: " + GetOneKey (atts));