[Mono-bugs] [Bug 45323][Nor] New - http module error

bugzilla-daemon@rocky.ximian.com bugzilla-daemon@rocky.ximian.com
Mon, 23 Jun 2003 20:41:37 -0400 (EDT)


Please do not reply to this email- if you want to comment on the bug, go to the
URL shown below and enter your comments there.

Changed by ljones@lithonia.com.

http://bugzilla.ximian.com/show_bug.cgi?id=45323

--- shadow/45323	Mon Jun 23 20:41:37 2003
+++ shadow/45323.tmp.5892	Mon Jun 23 20:41:37 2003
@@ -0,0 +1,129 @@
+Bug#: 45323
+Product: Mono/Class Libraries
+Version: unspecified
+OS: Red Hat 9.0
+OS Details: 
+Status: NEW   
+Resolution: 
+Severity: 
+Priority: Normal
+Component: System.Web
+AssignedTo: mono-bugs@ximian.com                            
+ReportedBy: ljones@lithonia.com               
+QAContact: mono-bugs@ximian.com
+TargetMilestone: ---
+URL: 
+Cc: 
+Summary: http module error
+
+Please fill in this template when reporting a bug, unless you know what 
+you are doing.
+Description of Problem:
+
+
+Steps to reproduce the problem:
+1.
+compile this module"
+
+using System;
+using System.Web;
+
+namespace MyModules
+{
+	public class AuthModule : IHttpModule
+	{
+
+		public delegate void MyHandler(object s, EventArgs e);
+		private MyHandler _eventHandler = null;
+
+		public void Init(HttpApplication myApp)
+		{
+			myApp.AuthenticateRequest += new EventHandler
+(OnEnter);
+			myApp.EndRequest += new EventHandler(OnLeave);
+		}
+
+		public void Dispose()
+		{
+		}
+
+		public event MyHandler MyEvent
+		{
+			add { _eventHandler += value; }
+			remove { _eventHandler -= value; }
+		}		
+		
+		public void OnEnter(object s, EventArgs e) 
+		{
+			HttpApplication objApp;
+			HttpContext objContext;
+			string strPath;
+			objApp = (HttpApplication) s;
+			objContext = objApp.Context;
+			strPath = objContext.Request.Path.ToLower();
+
+			if (strPath.Substring(strPath.Length - 10, 10 ) !
+=  "index.aspx") 
+			{
+				if (objContext.Request.Params["username"] 
+== null) 
+				{
+					objContext.Response.Redirect
+("index.aspx");
+				}
+			}
+		}
+
+		public void OnLeave(object s, EventArgs e)
+		{
+		}
+
+	}
+}
+ 
+2. 
+
+Add this to Web.Config file:
+
+    <httpModules>
+      <add name="AuthModule" 
+      type="MyModules.AuthModule,AuthModule" />
+    </httpModules>
+
+3. 
+If you go to index.aspx everything works fine.  I even put some debug code 
+in to verify it made it thru the module.  If I try to go to any other page 
+it crashes.
+
+Actual Results:
+Error
+Description: Error processing request. 
+Error Message: 
+
+Stack Trace: System.NullReferenceException: A null value was found where 
+an object instance was requiredin (unmanaged) 06 
+Apache.Web.Request:GetServerVariableInternal (intptr,string)in <0x00004> 
+06 Apache.Web.Request:GetServerVariableInternal (intptr,string)in 
+<0x00013> 00 Apache.Web.Request:GetServerVariable (string)in <0x00017> 00 
+Apache.Web.ApacheWorkerRequest:GetServerVariable (string)in <0x000f1> 00 
+System.Web.HttpRequest:ParseServerVariables ()in <0x00011> 00 
+System.Web.HttpRequest:get_ServerVariables ()in <0x000c0> 00 
+System.Web.HttpRequest:get_Params ()in <0x0013a> 00 
+MyModules.AuthModule:OnEnter (object,System.EventArgs)in <0x0006b> 01 
+System.MulticastDelegate:invoke_void_object_EventArgs 
+(object,System.EventArgs)in <0x0004b> 00 .EventState:Execute ()in 
+<0x00052> 00 .StateMachine:ExecuteState (IStateHandler,bool&)
+ 
+
+
+
+Expected Results:
+On MS IIS 5.0 with module created with VS.NET, the identical module, and 
+addition to Web.Config works fine.  If you try to go to any page other 
+than index.aspx without having the ?username=xxx in the path then it 
+redirects to index.aspx.
+
+How often does this happen? 
+
+
+Additional Information: