Hello,
The follow commit caused a regression in NET_1_1: Session_End in
global.asax is never called. The cause is an NullReferenceException in
FormsAuthenticationModule.Init() as "app.Context" is null (only in this
method and only when a session is about to be terminated).
2007-03-21 Vladimir Krasnov <[EMAIL PROTECTED]>
* FormsAuthenticationModule.cs: refactored configuration section to be
a member of a class
My patch moves the initialization of _config out of the Init method.
Please review.
- Juraj
Index: FormsAuthenticationModule.cs
===================================================================
--- FormsAuthenticationModule.cs (revision 75383)
+++ FormsAuthenticationModule.cs (working copy)
@@ -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 ();
if (_config == null || _config.Mode != AuthenticationMode.Forms) {
return;
}
@@ -157,6 +167,7 @@
return;
string loginPage;
+ InitConfig ();
#if NET_2_0
loginPage = _config.Forms.LoginUrl;
#else
_______________________________________________
Mono-devel-list mailing list
[email protected]
http://lists.ximian.com/mailman/listinfo/mono-devel-list