return;
HttpRuntime.EnableAssemblyMapping (true);
- ArrayList binAssembliesAl = null;
- string[] binAssemblies = null;
-
- foreach (string bindir in HttpApplication.PrivateBinPath) {
- if (!Directory.Exists (bindir))
- continue;
- if (binAssemblies == null)
- binAssembliesAl = new ArrayList ();
- binAssembliesAl.AddRange (Directory.GetFiles (bindir, "*.dll"));
- }
- if (binAssembliesAl != null)
- binAssemblies = (string[])binAssembliesAl.ToArray (typeof (string));
+ string[] binAssemblies = HttpApplication.BinDirectoryAssemblies;
foreach (AppCodeAssembly aca in assemblies)
aca.Build (binAssemblies);
} else
return;
- if (HttpApplication.LoadTypeFromPrivateBin (providerTypeName) == null)
+ if (HttpApplication.LoadTypeFromBin (providerTypeName) == null)
throw new HttpException (String.Format ("Profile provider type not found: {0}",
providerTypeName));
}
void AddAssembliesInBin (StringCollection coll)
{
- foreach (string private_bin_path in HttpApplication.PrivateBinPath) {
- if (!Directory.Exists (private_bin_path))
- continue;
-
- string [] binDlls = Directory.GetFiles (private_bin_path, "*.dll");
- foreach (string s in binDlls) {
- coll.Add (s);
- ref_assemblies.Add (s);
- }
+ foreach (string s in HttpApplication.BinDirectoryAssemblies) {
+ coll.Add (s);
+ ref_assemblies.Add (s);
}
}
+2007-08-23 Marek Habersack <mhabersack@novell.com>
+
+ * AppCodeCompiler.cs: use HttpApplication.BinDirectoryAssemblies
+ and HttpApplication.LoadTypeFromBin.
+
+ * BuildProvider.cs: use HttpApplication.BinDirectoryAssemblies in
+ AddAssembliesInBin.
+
2007-08-21 Marek Habersack <mhabersack@novell.com>
* BuildProvider.cs: use HttpApplication.PrivateBinPath enumerator
+2007-08-23 Marek Habersack <mhabersack@novell.com>
+
+ * ProvidersHelper.cs: HttpApplication.LoadTypeFromPrivateBin
+ renamed to LoadTypeFromBin.
+
2007-08-21 Marek Habersack <mhabersack@novell.com>
* ProvidersHelper.cs: use HttpApplication.LoadTypeFromPrivateBin
Type settingsType = Type.GetType (providerSettings.Type);
if (settingsType == null)
- settingsType = HttpApplication.LoadTypeFromPrivateBin (providerSettings.Type);
+ settingsType = HttpApplication.LoadTypeFromBin (providerSettings.Type);
// check App_Code dlls
if (settingsType == null) {
// CAS - no InheritanceDemand here as the class is sealed
[AspNetHostingPermission (SecurityAction.LinkDemand, Level = AspNetHostingPermissionLevel.Minimal)]
- public sealed class ApplicationHost {
-
+ public sealed class ApplicationHost {
static string [] types = { "Web.config", "Web.Config", "web.config" };
private ApplicationHost ()
setup.ConfigurationFile = FindWebConfig (physicalDir);
setup.DisallowCodeDownload = true;
- //
- // We use Path.PathSeparator even though MSDN says semicolons are used. Our
- // runtime expects a Path.PathSeparator.
- //
- setup.PrivateBinPath = String.Format ("Bin{0}bin", Path.PathSeparator);
+ if (Environment.GetEnvironmentVariable ("MONO_IOMAP") != null || HttpApplication.IsRunningOnWindows)
+ setup.PrivateBinPath = "bin";
+ else
+ setup.PrivateBinPath = String.Join (Path.PathSeparator.ToString (), HttpApplication.BinDirs);
setup.PrivateBinPathProbe = "*";
setup.ShadowCopyFiles = "true";
setup.ShadowCopyDirectories = setup.PrivateBinPath;
+2007-08-23 Marek Habersack <mhabersack@novell.com>
+
+ * ApplicationHost.cs: set AppDomainSetup.PrivateBinPath to "bin"
+ if running on Windows or with MONO_IOMAP in effect, and to
+ "Bin:bin" otherwise.
+
2007-08-21 Marek Habersack <mhabersack@novell.com>
* ApplicationHost.cs: AppDomainSetup.PrivateBinPath should contain
+2007-08-23 Marek Habersack <mhabersack@novell.com>
+
+ * SimpleWebHandlerParser.cs: use
+ HttpApplication.BinDirectoryAssemblies in AddAssembliesInBin and
+ LoadAssemblyFromBin.
+ Restore the old logic in GetTypeFromBin, also use
+ HttpApplication.BinDirectoryAssemblies there.
+
+ * TemplateParser.cs: use HttpApplication.BinDirectories to
+ interate over the list of bin dirs.
+ Use HttpApplication.BinDirectoryAssemblies in AddAssembliesInBin.
+
2007-08-23 Igor Zelmanovich <igorz@mainsoft.com>
* ClientScriptManager.cs: encode values of hidden fields.
void AddAssembliesInBin ()
{
- foreach (string bindir in HttpApplication.PrivateBinPath) {
- if (!Directory.Exists (bindir))
- continue;
-
- string [] binDlls = Directory.GetFiles (bindir, "*.dll");
- foreach (string s in binDlls) {
- try {
- Assembly assembly = Assembly.LoadFrom (s);
- AddAssembly (assembly, true);
- } catch (Exception e) {
- throw new Exception ("Error while loading " + s, e);
- }
+ foreach (string s in HttpApplication.BinDirectoryAssemblies) {
+ try {
+ Assembly assembly = Assembly.LoadFrom (s);
+ AddAssembly (assembly, true);
+ } catch (Exception e) {
+ throw new Exception ("Error while loading " + s, e);
}
-
}
}
Assembly LoadAssemblyFromBin (string name)
{
Assembly assembly = null;
- foreach (string bindir in HttpApplication.PrivateBinPath) {
- if (!Directory.Exists (bindir))
+ foreach (string dll in HttpApplication.BinDirectoryAssemblies) {
+ string fn = Path.GetFileName (dll);
+ fn = Path.ChangeExtension (fn, null);
+ if (fn != name)
continue;
- string [] binDlls = Directory.GetFiles (bindir, "*.dll");
- foreach (string dll in binDlls) {
- string fn = Path.GetFileName (dll);
- fn = Path.ChangeExtension (fn, null);
- if (fn != name)
- continue;
-
- assembly = Assembly.LoadFrom (dll);
- return assembly;
- }
+ assembly = Assembly.LoadFrom (dll);
+ return assembly;
}
return null;
internal Type GetTypeFromBin (string typeName)
{
Type result = null;
- Type type = null;
#if NET_2_0
IList toplevelAssemblies = BuildManager.TopLevelAssemblies;
if (toplevelAssemblies != null && toplevelAssemblies.Count > 0) {
foreach (Assembly asm in toplevelAssemblies) {
- type = asm.GetType (typeName, false);
+ Type type = asm.GetType (typeName, false);
if (type != null) {
if (result != null)
throw new HttpException (String.Format ("Type {0} is not unique.", typeName));
}
#endif
- foreach (string bindir in HttpApplication.PrivateBinPath) {
- if (!Directory.Exists (bindir))
- continue;
-
- string [] binDlls = Directory.GetFiles (bindir, "*.dll");
- foreach (string dll in binDlls) {
- Assembly assembly = Assembly.LoadFrom (dll);
- type = assembly.GetType (typeName, false);
- if (type != null) {
- if (result != null)
- throw new HttpException (String.Format ("Type {0} is not unique.", typeName));
+ foreach (string dll in HttpApplication.BinDirectoryAssemblies) {
+ Assembly assembly = Assembly.LoadFrom (dll);
+ Type type = assembly.GetType (typeName, false);
+ if (type != null) {
+ if (result != null)
+ throw new HttpException (String.Format ("Type {0} is not unique.", typeName));
- result = type;
- }
- }
+ result = type;
+ }
}
+
if (result == null)
throw new HttpException (String.Format ("Type {0} not found.", typeName));
AddDependency (location);
string dirname = Path.GetDirectoryName (location);
bool doAddAssembly = true;
- foreach (string dir in HttpApplication.PrivateBinPath) {
+ foreach (string dir in HttpApplication.BinDirectories) {
if (dirname == dir) {
doAddAssembly = false;
break;
void AddAssembliesInBin ()
{
- foreach (string bindir in HttpApplication.PrivateBinPath) {
- if (!Directory.Exists (bindir))
- continue;
-
- string [] binDlls = Directory.GetFiles (bindir, "*.dll");
- foreach (string s in binDlls)
- assemblies.Add (s);
- }
+ foreach (string s in HttpApplication.BinDirectoryAssemblies)
+ assemblies.Add (s);
}
internal virtual void AddInterface (string iface)
+2007-08-23 Marek Habersack <mhabersack@novell.com>
+
+ * HttpApplication.cs: added a static array BinDirs which contains
+ the common bin directory names we can encounter.
+ Added internal static property IsRunningOnWindows.
+ Added internal enumerable property BinDirectories to iterate over
+ the full paths of the available binary directories.
+ Added internal enumerable property BinDirectoryAssemblies to
+ iterate over .dll files in the bin directories.
+ LoadTypeFromPrivateBin renamed to LoadTypeFromBin.
+ LoadTypeFromBin uses BinDirectoryAssemblies.
+
+ * HttpApplicationFactory.cs: use HttpApplication.BinDirectories to
+ interate over the list of bin dirs.
+
2007-08-21 Marek Habersack <mhabersack@novell.com>
* HttpApplicationFactory.cs: watch for changes in all the
[ToolboxItem(false)]
public class HttpApplication : IHttpAsyncHandler, IHttpHandler, IComponent, IDisposable {
object this_lock = new object();
+
+ internal static readonly string [] BinDirs = {"Bin", "bin"};
HttpContext context;
HttpSessionState session;
yield return Path.Combine (baseDir, d);
}
}
-
+
+ internal static bool IsRunningOnWindows {
+ get {
+ PlatformID pid = Environment.OSVersion.Platform;
+ return ((int) pid != 128 && (int) pid != 4);
+ }
+ }
+
+ internal static IEnumerable BinDirectories
+ {
+ get {
+ AppDomainSetup setup = AppDomain.CurrentDomain.SetupInformation;
+ string baseDir = setup.ApplicationBase;
+ string bindir;
+
+ if (Environment.GetEnvironmentVariable ("MONO_IOMAP") != null || IsRunningOnWindows)
+ yield return Path.Combine (baseDir, "bin");
+ else {
+ foreach (string dir in BinDirs) {
+ bindir = Path.Combine (baseDir, dir);
+ if (!Directory.Exists (bindir))
+ continue;
+ yield return bindir;
+ }
+ }
+ }
+ }
+
+ internal static string[] BinDirectoryAssemblies
+ {
+ get {
+ ArrayList binDlls = null;
+ string[] dlls;
+
+ foreach (string bindir in BinDirectories) {
+ if (binDlls == null)
+ binDlls = new ArrayList ();
+ dlls = Directory.GetFiles (bindir, "*.dll");
+ binDlls.AddRange (dlls);
+ }
+
+ if (binDlls == null)
+ return new string[] {};
+ return (string[])binDlls.ToArray (typeof (string));
+ }
+ }
+
internal static Type LoadType (string typeName)
{
return LoadType (typeName, false);
}
#endif
- type = LoadTypeFromPrivateBin (typeName);
+ type = LoadTypeFromBin (typeName);
if (type != null)
return type;
return null;
}
- internal static Type LoadTypeFromPrivateBin (string typeName)
+ internal static Type LoadTypeFromBin (string typeName)
{
Type type = null;
- foreach (string dir in PrivateBinPath) {
- if (!Directory.Exists (dir))
+ foreach (string s in BinDirectoryAssemblies) {
+ Assembly binA = Assembly.LoadFrom (s);
+ type = binA.GetType (typeName, false);
+ if (type == null)
continue;
-
- string[] binDlls = Directory.GetFiles(dir, "*.dll");
- foreach (string s in binDlls) {
- Assembly binA = Assembly.LoadFrom (s);
- type = binA.GetType (typeName, false);
- if (type == null)
- continue;
- return type;
- }
+ return type;
}
return null;
factory.InitType (context);
lock (factory) {
if (factory.app_start_needed) {
- foreach (string dir in HttpApplication.PrivateBinPath)
+ foreach (string dir in HttpApplication.BinDirectories)
WatchLocationForRestart (dir, "*.dll");
#if NET_2_0
WatchLocationForRestart ("App_Code", "*", true);