+2007-04-04 Juraj Skripsky <js@hotfeet.ch>
+
+ * 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 <vladimirk@mainsoft.com>
* AnonymousIdentificationModule.cs: optimized Config property
#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 ()
{
{
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)
string loginPage;
bool slidingExpiration;
+ InitConfig (context);
if (_config == null || _config.Mode != AuthenticationMode.Forms) {
return;
}
return;
string loginPage;
+ InitConfig (context);
#if NET_2_0
loginPage = _config.Forms.LoginUrl;
#else