httpmodule

IIS Integrated Request Processing Pipeline -- Modify Request

Hi, I want to implement an ISAPI filter like feature using HttpModule in IIS7 running under IIS Integrated Request Processing Pipeline mode. The goal is to look at the incoming request at the Web Server level, and inject some custom HttpHeaders into the request. (for ex: HTTP_EAUTH_ID) And later in the page lifecycle of an ASPX page, i...

SEO and hard links with dynamic URLs

With ASP.NET MVC (or using HttpHandlers) you can dynamically generate URLs, like the one in this question, which includes the title. What happens if the title changes (for example, editing it) and there's a link pointing to the page from another site, or Google's Pagerank was calculated for that URL? I guess it's all lost right? (The l...

Exception handling using an HttpModule

We're reviewing one of the company's system's exception handling and found a couple of interesting things. Most of the code blocks (if not all of them) are inside a try/catch block, and inside the catch block a new BaseApplicationException is being thrown - which seems to be coming from the Enterprise Libraries. I'm in a bit of a troub...

IIS6 + HttpModule: This operation requires IIS integrated pipeline mode

I am using IIS6, I've written an HttpModule, and I get this error? After googling the web I find that this problem is caused by the .NET framework 3.5, so I put this on a machine where I didn't install .NET 3.5, but the problem is still there! ...

Remove or change Default Route post Global.asax

I'm building a CMS in ASP.NET MVC and want to allow users to pick which page they want to be displayed by default when the user first visits the site. I set my default route in Global.asax, like so (for example): routes.MapRoute( "Default", // Route name "{co...

Programmatically register HttpModules at runtime

I'm writing an app where 3rd party vendors can write plugin DLLs and drop them into the web app's bin directory. I want the ability for these plugins to be able to register their own HttpModules if necessary. Is there anyway that I can add or remove HttpModules from and to the pipeline at runtime without having a corresponding entry in...

Can I access session state from an HTTPModule?

Hi, I could really do with updating a user's session variables from within my HTTPModule, but from what I can see, it isn't possible. UPDATE: My code is currently running inside the OnBeginRequest () event handler. UPDATE: Following advice received so far, I tried adding this to the Init () routine in my HTTPModule: AddHandler contex...

Determine HttpModule main/calling Request

Is there a way to know the main/calling request in an httpmodule? I only want my module code to run for the main aspx page, not the images and scripts. I could check the path for ".aspx" but it seems like there should be a better way. ...

ASP.NET HttpModule - guaranteed execution of pre- and post- handler code?

Basically, I'm trying to write the following (pseudocode) in an ASP.NET HttpModule: *pre-code* try { handler.ProcessRequest(...) } catch (Exception) { *error-code* } finally { *post-code* } I've found that I can hook into HttpModule.PreExecuteHandler for "pre-code" and .Error for "error-code". But PostExecuteHandler doesn't seem to b...

Bizarre Firefox Input Bug

I'm a bit flabbergasted at this, so I'm wondering if any SOers have encountered it before. I have an essentially flat page with a number of input=text seeded in the markup with default values of say A,B,C,D,E in order. The markup looks like this in view source: <td class="action invoice"> <a href="#foo">Toggle Invoice</a> <div clas...

How to have http module on fire events only for specific page types

I have an http module on a sharepoint site and this module instantiates a custom class and add it to the session and does other initial things for my site. However, I'm noticing that the http module is being called for all request types (.aspx, .js, .png, .jpg). Is there any way to have an http module only be called for .net specific pa...

HttpModule - get HTML content or controls for modifications

Tried something like this: HttpApplication app = s as HttpApplication; //s is sender of the OnBeginRequest event System.Web.UI.Page p = (System.Web.UI.Page)app.Context.Handler; System.Web.UI.WebControls.Label lbl = new System.Web.UI.WebControls.Label(); lbl.Text = "TEST TEST TEST"; p.Controls.Add(lbl); when running this I get "Object ...

HttpModule disables SharePoint 2003 admin...

I have a web part with links to e.g. "Manage Users" i SharePoint (2003) I also have a http module, that must add some JavaScript to the aspx pages served through the sharePoint site. This runs well for normal user served pages but when clicking these admin pages, served by the web part... What can be wrong and how do I adapt my filter...

HttpModule with filter - Writer method is called twice...

I have a HttpModule with a filter (PageFilter) where the Writer method of PageFilter is called twice for every page request, unfortunately not with the same result. The idea of the filter is to locate "" and insert some text/script in front of this. I have located a bunch of minor errors (and corrected them), but this error is playing t...

HttpModule doesn't seem to work

I've created a simple HttpModule to log the uses of my existing webservice. There's a dll containing a single class public class TrackingModule : System.Web.IHttpModule { public TrackingModule(){} public void Init(System.Web.HttpApplication context) { context.BeginRequest+=new EventHandler(context_BeginRequest); ...

How can I hook into the current FormsAuthenticationModule in a Medium Trust environment?

I've got an HttpModule in my application that hooks into the FormsAuthenticationModule's Authenticate event with the following code: public void Init(HttpApplication context) { FormsAuthenticationModule faModule = (FormsAuthenticationModule)context.Modules["FormsAuthentication"]; faModule.Authenticate += new Form...

HTTPModule Event Execution Order?

Does anyone know of a site or page, or know the order of execution for the events of the HTTPApplication class for HTTPModule event execution? I found the MSDN Documentation for all of the events, but it doesn't show a list of process steps and I haven't been able to find one. ...

Dependency Injecting an HTTPModule

Google/MyBrain are failing me. Without using a framework (which I'll never get past my colleagues), how do you inject a dependency into an HTTPModule given that you (the programmer) are not in control of creating the instance? Are we into hacking up custom web.config sections + reflection or is there something cleaner I'm not seeing? e...

Dynamically Load HTTP Modules, Possibly with Unity?

Has anyone seen any how-to, documentation, or otherwise about how to load HTTP Modules dynamically for IIS? Basically what I am trying to do is to load HTTP Modules, which I'll call HTTPModuleA, HTTPModuleB, and HTTPModuleC. The modules however could be changed out at any time with HTTPModuleD, HTTPModuleE, or HTTPModuleF. I basically...

Using HttpModule with .html file extension

I need access to session in httpmodule. It works fine when my page is a aspx page, but context.session is null when the request url is .html I have .html mapped to use aspnet_isapi.dll I am trying to access session in context_PreRequestHandlerExecute and I have httpmodule inherit IReadOnlySessionState ...