//
using System;
using System.Collections;
+using System.Collections.Generic;
using System.IO;
using System.Web;
using System.Web.Compilation;
{
internal class UserControlParser : TemplateControlParser
{
-#if NET_2_0
string masterPage;
+#if NET_4_0
+ string providerName;
#endif
-
- internal UserControlParser (string virtualPath, string inputFile, HttpContext context)
+ internal UserControlParser (VirtualPath virtualPath, string inputFile, HttpContext context)
: this (virtualPath, inputFile, context, null)
{
}
- internal UserControlParser (string virtualPath, string inputFile, ArrayList deps, HttpContext context)
+ internal UserControlParser (VirtualPath virtualPath, string inputFile, List <string> deps, HttpContext context)
: this (virtualPath, inputFile, context, null)
{
this.Dependencies = deps;
}
-
- internal UserControlParser (string virtualPath, string inputFile, HttpContext context, string type)
+
+ internal UserControlParser (VirtualPath virtualPath, string inputFile, HttpContext context, string type)
{
+ VirtualPath = virtualPath;
Context = context;
- BaseVirtualDir = UrlUtils.GetDirectory (virtualPath);
+ BaseVirtualDir = virtualPath.DirectoryNoNormalize;
InputFile = inputFile;
SetBaseType (type);
AddApplicationAssembly ();
+ LoadConfigDefaults ();
}
-#if NET_2_0
- internal UserControlParser (string virtualPath, TextReader reader, HttpContext context)
+ internal UserControlParser (VirtualPath virtualPath, TextReader reader, HttpContext context)
: this (virtualPath, null, reader, context)
{
}
- internal UserControlParser (string virtualPath, string inputFile, TextReader reader, HttpContext context)
+ internal UserControlParser (VirtualPath virtualPath, string inputFile, TextReader reader, HttpContext context)
{
+ VirtualPath = virtualPath;
Context = context;
- BaseVirtualDir = UrlUtils.GetDirectory (virtualPath);
-
- if (String.IsNullOrEmpty (inputFile)) {
- HttpRequest req = context != null ? context.Request : null;
- if (req != null)
- InputFile = req.MapPath (virtualPath);
- } else
+ BaseVirtualDir = virtualPath.DirectoryNoNormalize;
+
+ if (String.IsNullOrEmpty (inputFile))
+ InputFile = virtualPath.PhysicalPath;
+ else
InputFile = inputFile;
Reader = reader;
SetBaseType (null);
AddApplicationAssembly ();
+ LoadConfigDefaults ();
}
internal UserControlParser (TextReader reader, int? uniqueSuffix, HttpContext context)
Context = context;
string fpath = context.Request.FilePath;
- BaseVirtualDir = UrlUtils.GetDirectory (fpath);
+ VirtualPath = new VirtualPath (fpath);
+ BaseVirtualDir = VirtualPathUtility.GetDirectory (fpath, false);
// We're probably being called by ParseControl - let's use the requested
// control's path plus unique suffix as our input file, since that's the
Reader = reader;
SetBaseType (null);
AddApplicationAssembly ();
+ LoadConfigDefaults ();
}
internal static Type GetCompiledType (TextReader reader, int? inputHashCode, HttpContext context)
UserControlParser ucp = new UserControlParser (reader, inputHashCode, context);
return ucp.CompileIntoType ();
}
-#endif
- internal static Type GetCompiledType (string virtualPath, string inputFile, ArrayList deps, HttpContext context)
+ internal static Type GetCompiledType (string virtualPath, string inputFile, List <string> deps, HttpContext context)
{
- UserControlParser ucp = new UserControlParser (virtualPath, inputFile, deps, context);
+ UserControlParser ucp = new UserControlParser (new VirtualPath (virtualPath), inputFile, deps, context);
+
return ucp.CompileIntoType ();
}
public static Type GetCompiledType (string virtualPath, string inputFile, HttpContext context)
{
- UserControlParser ucp = new UserControlParser (virtualPath, inputFile, context);
+ UserControlParser ucp = new UserControlParser (new VirtualPath (virtualPath), inputFile, context);
+
return ucp.CompileIntoType ();
}
- protected override Type CompileIntoType ()
+ internal override Type CompileIntoType ()
{
AspGenerator generator = new AspGenerator (this);
return generator.GetCompiledType ();
}
- internal override void ProcessMainAttributes (Hashtable atts)
+ internal override void ProcessMainAttributes (IDictionary atts)
{
-#if NET_2_0
masterPage = GetString (atts, "MasterPageFile", null);
if (masterPage != null)
AddDependency (masterPage);
-#endif
base.ProcessMainAttributes (atts);
}
+#if NET_4_0
+ internal override void ProcessOutputCacheAttributes (IDictionary atts)
+ {
+ providerName = GetString (atts, "ProviderName", null);
+ base.ProcessOutputCacheAttributes (atts);
+ }
-#if NET_2_0
- internal override string DefaultBaseTypeName {
- get { return PagesConfig.UserControlBaseType; }
+ internal override Type DefaultBaseType {
+ get {
+ Type ret = PageParser.DefaultUserControlBaseType;
+ if (ret == null)
+ return base.DefaultBaseType;
+
+ return ret;
+ }
}
-#else
+#endif
internal override string DefaultBaseTypeName {
- get { return "System.Web.UI.UserControl"; }
+ get { return PagesConfig.UserControlBaseType; }
}
-#endif
+
internal override string DefaultDirectiveName {
get { return "control"; }
}
-#if NET_2_0
internal string MasterPageFile {
get { return masterPage; }
}
+#if NET_4_0
+ internal string ProviderName {
+ get { return providerName; }
+ }
#endif
-
}
}