httpmodule

Running log operation in Http Modules?

Hi, I have a simple requirement in which I want to execute a long running application program on server (e.g. DTSX) I want to make an HTTP module for this, But I have a question whether the DTSX will run even if the user closes the page and browser. In my case user hits the handler with a query string but what if the user closes the bro...

Automatically logging into and out of FBA SharePoint site

We've got a WSS 3.0 site that is using Forms Based Authentication (FBA). We want to set the site up so that certain users can be logged in automatically, rather then getting the login screen, and I'm not sure of the best way to do this. Actually, based on this article, I've already created an HTTP Module that handles the logging in. M...

Why HttpContext.Current.Handler is null?

Hi, I'm trying to access a Page within an HttpModule and I think I should do this by calling HttpContext.Current.Handler (This should reference the current page) but I'm getting null all the time. I'm developing using .Net 3.5 framework. I'm checking this on AuthorizeRequest and AuthenticateRequest Thanks. ...

Caching across requests with HttpModule

I have written an HttpModule that accepts the request, processes it (via a database lookup), and outputs results (html) back to the response. (Note that the HttpModule actually ends the request after it is done, so there is no normal ASP.NET processing of the request.) As the database lookup can be expensive/time-consuming, I would like...

HttpModule Init method is called several times - why?

I was creating a http module and while debugging I noticed something which at first (at least) seemed like weird behaviour. When i set a breakpoint in the init method of the httpmodule i can see that the http module init method is being called several times even though i have only started up the website for debugging and made one single...

HttpModule and static class, do multiple requests share the same static data?

I have written an ASP.NET HttpModule and I have a static helper class that is used to load and store configuration data for the life of the request. Since static constructors must be parameterless, I have a static SetConfigName method that I call at the start of the processing of the HttpRequest. public static void SetConfigName (s...

Exclude HttpModule from running for static content on IIS7

I have a problem with my Authentication HttpModule. The problem is that it obviously runs for every single request I get on my web server (IIS7). Because it also uses Session variable, it fails to work properly on CSS, JS files and similar. I tried to use: <add name="AuthModuleName" type="..." preCondition="managedHandler" /> but to ...

Asp.net MVC error with configured managed modules

I have a custom authentication HttpModule that is pretty strait forward. But I want it to run only for managed requests (and not for static ones). Asp.net MVC automatically adds configuration section for IIS7 web server: <system.webServer> <validation validateIntegratedModeConfiguration="false" /> <modules runAllManagedModulesFor...

HttpModule/HttpApplication testing whether url is a request for a file

Hi, Within a HttpModule I would like to check whether the url ends with a file: ie. www.example.com/images/images.css and what the file extension is ie. css or js In the Begin_Request event handler, using the Url property of the Request object nested in the HttpApplication, I am currently cutting of the file extension using String op...

Asp.Net Authentication Module

I have created an authentication module in ASP.Net but I do not want the logic in the authentication module to be executed if the resource is configured for anonymous access since the logic is expensive. There are pages that require authentication in the same directory with pages that do not require authentication. I have no control ove...

Global.asax issue

Hello everyone, I am developing an HttpModule and using Global.asax. I have developed a class which derives from HttpApplication, but Application_Start method of my class never executes (I create a file at the beginning of Application_Start but the file never creates, and it is why I think Application_Start never executes). I am using V...

Which event to handle in HttpModule for setting the current principal when dealing with providers?

I am facing a problem where I have to integrate with a custom HttpModule where the principal and identity are set on the current thread so that HttpContext.Current.User contains these. However I get the feeling that the eventhandler they used (PostAcquireRequestState) is way too late. Which is the best event to handle before the initial...

.net Url rewriting for localization, issues with forms authentication and the loginUrl

I'm using a HttpModule to rewrite the urls on a multi-lingual site. In the HttpModule, I'm adding a handler for the BeginRequest event, and looking for the first part of the path which contains the culture name. For example, /fr-ca/index.aspx will be rewritten to /index.aspx and set the thread's culture and ui culture to 3084. This work...

Is it possible to skip a HttpHandler if there is no querystring?

I wrote a dynamic image resizer as a HttpHandler. It's automatically called on anything with an image extension, so for example: http://www.mysite.com/picture.jpg?width=200&amp;height=100 will run the handler and return a thumbnail image with the proper response headers. However, I want the handler to let a request 'pass through' if it...

BUG: IIS7 managed requests

(I don't know whether should I also post this question to ServerFault, since it's about IIS configuration?) In IIS7 we can tell a module to run for managed content (thus speeding up static content serving) by: <modules> ... <add name="WhateverName" type="WhateverType" preCondition="managedHandler" ... </modules>...

C# ASP.NET HttpModules: HttpApplication Events

Hi All, I have an HttpApplication (Global.asax) in my web application, I use this to catch and log unhandled Exceptions and to setup WebFormURLRouting. This all works, however I want to move this code into my Application Framework, (ie not in Global.asax.cs) I have just tried to create an HttpApplication class in the framework but it s...

HttpResponse filter returns nothing

I have written a HttpModule that I am using to intercept calls the the WebResource.axd handler so I can perform some post processing on the javascript. The module wraps the Response.Filter stream to perform its processing and writes it's changes to the underlying stream. The problem I have is that the script does not get returned to th...

HTTPModule for static files sometimes fails to run on IIS 6

I have and HTTP module that cleans, compresses and minifies CSS, JS, and HTML files based on their content type header. It works great in my staging environment and localhost (ISS7, classic pipeline mode). On IIS 6 (production), it is not reliable. Sporadically, this static files stop being processed by asp.net and appear to be reverting...

Response.Redirect in HttpModule

Can I do a redirect to a custom page in an HttpModule? I have an HttpModule A which executes some javascript code when any aspx page is loaded. I would like to have a server side code check to see if the clients browsers supports cookies. Can I place that code in the HttpModule A? If so, in which event? Or do I need to have a new HttpHa...

Require client certificates in IIS for non-local network requests using HttpModule

I need to require client certificates on a site in IIS for any request that does not originate from the local network. Any local requests should not require client certificates. Is there a way to do this in IIS? I was thinking of configuring IIS to allow client certificates but not require them and then use a custom HttpModule that wo...