I downloaded a sample code for a video on the www.asp.net website that talks about HttpModule! It works fine, when I move the same HttpModule to my application, the module never runs!! Is there a special workaround we should
do to make an HttpModule works on a website under .NET 3.0\5 on VS 2008 Beta 2 with Vista/IIS 7?
Holy crap this fixed my issue. Same as the unlucky soul above I was scratching my head at this. The module worked perfectly in "Cassini" the buit in webdev server in Visual Studio but no go on a production IIS 7.0.
Basically registered the module in both places in the web config. both the <httpModules> section and the <modules> section.
This was very frustrating not to mention that this was the only place I could find anything regarding the issue.
Stuff like this is really annoying.
So Bilal a toast to you, or in this case let's just go with the bottle....I need it right about now whew!
SomeNewTrick...
Participant
1769 Points
364 Posts
HttpModule Events not firing in ASP.NET 2.0
Sep 10, 2007 08:03 PM|LINK
Hello, Please help me find why this HttpModule is not firing at all
using System; using System.Collections; using System.Data; using System.Diagnostics; using System.Web; namespace MyModules { public class TestHttpModule : IHttpModule { public void Init(System.Web.HttpApplication Application) { Application.Error += new System.EventHandler(OnError); } public void Dispose() { } protected virtual void OnError(object sender, EventArgs args) { HttpApplication app = (HttpApplication)sender; app.Server.GetLastError(); app.Response.Write("An error"); app.Context.ClearError(); app.Response.End(); } } }I placed the above class in the App_Code folder. In the web.config file, I useed this:
<
httpModules> <add name="TestHttpModule" type="MyModules.TestHttpModule" /></
httpModules>Any help please? In the Default.aspx page I am writing "throw new ApplicationError("..")" and I see that the HttpModule is not firing any event!
Thanks
ankitarora13
Member
37 Points
9 Posts
Re: HttpModule Events not firing in ASP.NET 2.0
Sep 11, 2007 12:13 PM|LINK
Try specifying the following....
<httpModules> <add name="TestHttpModule" type="MyModules.TestHttpModule, MyModules" /></
httpModules>Rgds,
Ankit
SomeNewTrick...
Participant
1769 Points
364 Posts
Re: HttpModule Events not firing in ASP.NET 2.0
Sep 11, 2007 12:25 PM|LINK
But I am placing the code in App_Code and not in a seperate assembly to specify MyModules!
Anyone please?
Thanks
SomeNewTrick...
Participant
1769 Points
364 Posts
Re: HttpModule Events not firing in ASP.NET 2.0
Sep 11, 2007 08:02 PM|LINK
This is driving me crazy!
I downloaded a sample code for a video on the www.asp.net website that talks about HttpModule! It works fine, when I move the same HttpModule to my application, the module never runs!! Is there a special workaround we should do to make an HttpModule works on a website under .NET 3.0\5 on VS 2008 Beta 2 with Vista/IIS 7?
Thanks
haidar_bilal
All-Star
45609 Points
8730 Posts
MVP
Re: HttpModule Events not firing in ASP.NET 2.0
Sep 13, 2007 09:11 AM|LINK
This is related to IIS 7 and Integrated Mode related to Application pool. Have a look at this post of mine, I had same thing and I did solve it!!
http://bhaidar.net/cs/archive/2007/09/12/httpmodules-and-iis-7.aspx
Regards
Professional ASP.NET 3.5 Security, Membership, and Role Management with C# and VB
chazelton
Member
102 Points
53 Posts
Re: HttpModule Events not firing in ASP.NET 2.0
Apr 07, 2010 05:22 AM|LINK
Holy crap this fixed my issue. Same as the unlucky soul above I was scratching my head at this. The module worked perfectly in "Cassini" the buit in webdev server in Visual Studio but no go on a production IIS 7.0.
Basically registered the module in both places in the web config. both the <httpModules> section and the <modules> section.
This was very frustrating not to mention that this was the only place I could find anything regarding the issue.
Stuff like this is really annoying.
So Bilal a toast to you, or in this case let's just go with the bottle....I need it right about now whew!
meetsankar
Member
4 Points
3 Posts
Re: HttpModule Events not firing in ASP.NET 2.0
Apr 23, 2010 10:54 AM|LINK
Thanks chazelton you saved me lot of time :)
politus
Member
86 Points
14 Posts
Re: HttpModule Events not firing in ASP.NET 2.0
Jul 15, 2011 02:32 PM|LINK
the link in the answer is now http://bhaidar.net/post/2007/09/13/HttpModules-and-IIS-7.aspx