浏览代码

2008-03-10 Marek Habersack <[email protected]>

	* RoleManagerModule.cs: initialize _config before adding event
	handlers and account for the fact that _config might still be null
	in the methods that use it.

svn path=/trunk/mcs/; revision=97907
Marek Habersack 18 年之前
父节点
当前提交
96589d0402

+ 6 - 0
mcs/class/System.Web/System.Web.Security/ChangeLog

@@ -1,3 +1,9 @@
+2008-03-10  Marek Habersack  <[email protected]>
+
+	* RoleManagerModule.cs: initialize _config before adding event
+	handlers and account for the fact that _config might still be null
+	in the methods that use it.
+
 2007-12-30  Vladimir Krasnov  <[email protected]>
 
 	* SqliteMembershipProvider.cs, SqlRoleProvider.cs: added chema checking

+ 4 - 4
mcs/class/System.Web/System.Web.Security/RoleManagerModule.cs

@@ -62,7 +62,7 @@ namespace System.Web.Security {
 			HttpApplication app = (HttpApplication)sender;
 
 			/* if we're disabled, bail out early */
-			if (!_config.Enabled)
+			if (_config == null || !_config.Enabled)
 				return;
 
 			/* allow the user to populate the Role */
@@ -116,7 +116,7 @@ namespace System.Web.Security {
 
 			/* if we're not enabled or configured to cache
 			 * cookies, bail out */
-			if (!_config.Enabled || !_config.CacheRolesInCookie)
+			if (_config == null || !_config.Enabled || !_config.CacheRolesInCookie)
 				return;
 
 			/* if the user isn't authenticated, bail
@@ -157,10 +157,10 @@ namespace System.Web.Security {
 
 		public void Init (HttpApplication app)
 		{
+			_config = (RoleManagerSection) WebConfigurationManager.GetSection ("system.web/roleManager");
+
 			app.PostAuthenticateRequest += OnPostAuthenticateRequest;
 			app.EndRequest += OnEndRequest;
-
-			_config = (RoleManagerSection) WebConfigurationManager.GetSection ("system.web/roleManager");
 		}
 	}
 }