Ok Jacob.
Create a Simple WebApplication1 Project and add to it's solution a new class
library project (the MyHttpModule) add to the WebApplication1 references a
reference to the MyHttpModule project.
Add to the Web.config file a reference to the dll (see below)
Add to the WebApplication1 project two htm pages called test1.htm and
test2.htm, copy the following codes for each pages and try it.
The call to the module for the aspx page work always but to the htm page
work only the first time or only when you refresh it
I'm using IE 6 with (menu--> tools --> internet options --> Settings -->
Every visit to this page "checked")
IIS 5.1 with application mapping for 'htm' pages in the Default web site to
(C:\WINDOWS\Microsoft.NET\Framework\v1.1.4322\aspnet_isapi.dll)
//*********** HttpModuleClass
using System;
using System.Web;
namespace MyHttpModule
{ public class MyHttpModuleClass : IHttpModule {
public MyHttpModuleClass(){}
public void Init(HttpApplication application) {
application.PreRequestHandlerExecute += (new
EventHandler(this.Application_PreRequestHandlerExecute));
}
protected void Application_PreRequestHandlerExecute (Object source,
EventArgs e){
HttpContext Context = ((HttpApplication)source).Context;
if (Context.Session!=null){
if (Context.Session["nPageCalled"]!=null)
Context.Session["nPageCalled"]=
((int)(Context.Session["nPageCalled"]))+1;
else
Context.Session["nPageCalled"]= 1;
Context.Response.Write("<br><br><br><br><h2><font color=red>My Module
Called "+Context.Session["nPageCalled"]+"</font></h2>");
}
}
public void Dispose() {}
}
}
//*********** HttpModuleClass END
//************ WebForm1.aspx
<body MS_POSITIONING="GridLayout">
<form id="Form1" method="post" runat="server">
<asp:HyperLink id="HyperLink1" style="Z-INDEX: 101; LEFT: 20px; POSITION:
absolute; TOP: 9px" runat="server"
NavigateUrl="test1.htm">Test1</asp:HyperLink>
<asp:HyperLink id="HyperLink2" style="Z-INDEX: 102; LEFT: 117px;
POSITION: absolute; TOP: 8px"
runat="server" NavigateUrl="test2.htm">Test2</asp:HyperLink>
</form>
</body>
//************ WebForm1.aspx END
//************ Test1.htm AND Test2.htm
<head>
<META HTTP-EQUIV="expires" CONTENT="Thu, 27 Jun 1980 10:56:57 GMT">
<META HTTP-EQUIV="cache-control" CONTENT="no-cache">
</head>
<body>
<a href="WebForm1.aspx">Go Back</a>
</body>
//************ Test1.htm AND Test2.htm END
//************ WEB.CONFIG
<httpModules>
<add name="MyHttpModule" type="MyHttpModule.MyHttpModuleClass,
MyHttpModule" />
</httpModules>
//************ WEB.CONFIG END
Hope this help you to reproduce the problem
let me know
Paps