+2007-10-17 Marek Habersack <mhabersack@novell.com>
+
+ * WebConfigurationHost.cs: if running outside hosted environment,
+ read only the assemblyname.config configuration file instead of
+ web.config. Fixes bug #332425
+
2007-10-15 Marek Habersack <mhabersack@novell.com>
* ProvidersHelper.cs: use HttpApplication.LoadType instead of
using System.Security;
using System.Configuration;
using System.Configuration.Internal;
+using System.Web.Hosting;
using System.Web.Util;
using System.Reflection;
if (file != null)
return file.FullName;
#else
- string[] filenames = new string[] {"Web.Config", "Web.config", "web.config" };
+ AppDomain domain = AppDomain.CurrentDomain;
+ bool hosted = (domain.GetData (ApplicationHost.MonoHostedDataKey) as string) == "yes";
- foreach (string fn in filenames) {
- string file = Path.Combine (dir, fn);
- if (File.Exists (file))
- return file;
- }
+ if (hosted) {
+ foreach (string fn in ApplicationHost.WebConfigFileNames) {
+ string file = Path.Combine (dir, fn);
+ if (File.Exists (file))
+ return file;
+ }
#endif
+ } else {
+ Assembly asm = Assembly.GetEntryAssembly () ?? Assembly.GetCallingAssembly ();
+ string name = Path.GetFileName (asm.Location);
+ string[] fileNames = new string[] {name + ".config", name + ".Config"};
+ string appDir = domain.BaseDirectory;
+ string file;
+
+ foreach (string fn in fileNames) {
+ file = Path.Combine (appDir, fn);
+ if (File.Exists (file))
+ return file;
+ }
+ }
+
return null;
}
#if TARGET_J2EE
// CAS - no InheritanceDemand here as the class is sealed
[AspNetHostingPermission (SecurityAction.LinkDemand, Level = AspNetHostingPermissionLevel.Minimal)]
- public sealed class ApplicationHost {
- static string [] types = { "Web.config", "Web.Config", "web.config" };
+ public sealed class ApplicationHost {
+ internal static readonly string MonoHostedDataKey = ".:!MonoAspNetHostedApp!:.";
+ internal static string [] WebConfigFileNames = { "Web.config", "Web.Config", "web.config" };
private ApplicationHost ()
{
{
string r = null;
- foreach (string s in types){
+ foreach (string s in WebConfigFileNames){
r = Path.Combine (basedir, s);
if (File.Exists (r))
#if NET_2_0
appdomain.SetData ("DataDirectory", Path.Combine (physicalDir, "App_Data"));
#endif
+ appdomain.SetData (MonoHostedDataKey, "yes");
+
return appdomain.CreateInstanceAndUnwrap (hostType.Module.Assembly.FullName, hostType.FullName);
}
}
+2007-10-17 Marek Habersack <mhabersack@novell.com>
+
+ * ApplicationHost.cs: introduce an application domain data item to
+ allow checks for whether System.Web code runs inside a hosted
+ application or in a stand-alone one.
+ Made the array of web.config name variations an internal one, to
+ be used from within configuration code.
+
2007-08-24 Marek Habersack <mhabersack@novell.com>
* ApplicationHost.cs: use ; as the separator with PrivateBinPath.