Author: juraj
Date: 2007-04-04 09:54:51 -0400 (Wed, 04 Apr 2007)
New Revision: 75387
Modified:
trunk/mcs/class/System.Web/System.Web.Security/ChangeLog
trunk/mcs/class/System.Web/System.Web.Security/FormsAuthenticationModule.cs
Log:
2007-04-04 Juraj Skripsky <[EMAIL PROTECTED]>
* FormsAuthenticationModule.cs: Move initialization of _config out
of Init() as app.Context is null in that method when a session is
about to be terminated.
Modified: trunk/mcs/class/System.Web/System.Web.Security/ChangeLog
===================================================================
--- trunk/mcs/class/System.Web/System.Web.Security/ChangeLog 2007-04-04
13:47:07 UTC (rev 75386)
+++ trunk/mcs/class/System.Web/System.Web.Security/ChangeLog 2007-04-04
13:54:51 UTC (rev 75387)
@@ -1,3 +1,9 @@
+2007-04-04 Juraj Skripsky <[EMAIL PROTECTED]>
+
+ * FormsAuthenticationModule.cs: Move initialization of _config out
+ of Init() as app.Context is null in that method when a session is
+ about to be terminated.
+
2007-03-21 Vladimir Krasnov <[EMAIL PROTECTED]>
* AnonymousIdentificationModule.cs: optimized Config property
Modified:
trunk/mcs/class/System.Web/System.Web.Security/FormsAuthenticationModule.cs
===================================================================
--- trunk/mcs/class/System.Web/System.Web.Security/FormsAuthenticationModule.cs
2007-04-04 13:47:07 UTC (rev 75386)
+++ trunk/mcs/class/System.Web/System.Web.Security/FormsAuthenticationModule.cs
2007-04-04 13:54:51 UTC (rev 75387)
@@ -44,6 +44,20 @@
#else
AuthConfig _config = null;
#endif
+ bool isConfigInitialized = false;
+
+ private void InitConfig (HttpContext context)
+ {
+ if(isConfigInitialized)
+ return;
+#if NET_2_0
+ _config = (AuthenticationSection)
WebConfigurationManager.GetSection ("system.web/authentication");
+#else
+ _config = (AuthConfig) context.GetConfig
("system.web/authentication");
+#endif
+ isConfigInitialized = true;
+ }
+
[SecurityPermission (SecurityAction.Demand, UnmanagedCode =
true)]
public FormsAuthenticationModule ()
{
@@ -57,11 +71,6 @@
{
app.AuthenticateRequest += new EventHandler
(OnAuthenticateRequest);
app.EndRequest += new EventHandler (OnEndRequest);
-#if NET_2_0
- _config = (AuthenticationSection)
WebConfigurationManager.GetSection ("system.web/authentication");
-#else
- _config = (AuthConfig) app.Context.GetConfig
("system.web/authentication");
-#endif
}
void OnAuthenticateRequest (object sender, EventArgs args)
@@ -74,6 +83,7 @@
string loginPage;
bool slidingExpiration;
+ InitConfig (context);
if (_config == null || _config.Mode !=
AuthenticationMode.Forms) {
return;
}
@@ -157,6 +167,7 @@
return;
string loginPage;
+ InitConfig (context);
#if NET_2_0
loginPage = _config.Forms.LoginUrl;
#else
_______________________________________________
Mono-patches maillist - [email protected]
http://lists.ximian.com/mailman/listinfo/mono-patches