Here is what I'm specifically trying to do:
I have written a HttpModule to do some site specific tracking. Some old .aspx pages on our site are hard coded with no real controls, but they are .aspx files so my module still runs when they are requested.
My module's handler is attached to the PostRequestHandlerExecute, so I believe what ...
I am writing a custom c# HttpModule that will handle requests from all file types. As a simple proof of concept I have setup the module by adding a reference to the httpModules section of the web config and added application extensions for the demo IIS website with a reference to the aspnet_isapi.dll so that it currently only intercepts ...
The HttpModule works fine ("hello" is replaced with "hello world") but for some reasons images on the WebForms are not displayed when the module is added to the Web.config. When the module is removed from the Web.config, images on the WebForms are displayed.
Does anyone know why?
The HTML that is produced with or without the HttpModule...
I have an HttpModule that I have put together from cobbling a couple of different sources online together into something that (mostly) works with both traditional ASP.NET applications, as well as ASP.NET MVC applications. The largest part of this comes from the kigg project on CodePlex. My problem is in dealing with 404 errors due to a...
I have been trying to implement an ajax-style file upload. I was wondering what we must do to report the uploading progress. I am trying to implement this in my asp.net web page.
I understand the mechanism by which we can upload a file, ajax-style, on a web page. I have been googling a lot about how to show a progress bar, but I don't s...
I am developing a http module that hooks into the FormsAuthentication Module through the Authenticate event.
While debugging i noticed that the module (and all other modules registered) gets hit every single time the client requests a resource (also when it requests images, stylesheets, javascript files (etc.)).
This happens both when r...
I want to log site traffic in .Net using an HttpModule. in the HttpContext.EndRequest event handler I'm storing the Response.ContentType property value to the database. On my local dev instance it is storing the correct content types i.e: image/gif for .gif, text/html for .aspx etc. However on an IIS 6 server it always stores the content...
Hi all,
I've created a simple HttpModule and response stream to reformat the rendered output of web pages (see code snippets below).
In the HttpModule I set the Response.Filter to my PageStream:
m_Application.Context.Response.Filter = new PageStream(m_Application.Context);
In the PageStream I overwrite the Write method in order to d...
I am trying to use this upload control as recommended by someone on here:
http://darrenjohnstone.net/2008/07/15/aspnet-file-upload-module-version-2-beta-1/
So I'm trying to implement a custom processor in order to store the uploaded files in the session. However, when the file is passed to the processor (from the HttpModule) the SEssi...
I have a custom HttpModule rewrite engine in an existing web application project that maps urls of the form
/tom/dick/harry/.../.../...
to a hierarchical navigation system stored in a database, ultimately resulting in a HttpContext.Current.RewritePath() call to the .aspx page that the requested path resolves to.
I'm interested in mixi...
I have an HTTP module in a dll, being used in a web application.
I need to call a class in the web application (using a Interface defined within the dll - so we are not tightly coupled).
I define the class in the appsettings of a web.config, but cannot figure how to create an instance.
I use Type.GetType but it just returns a null.
...
public class MyModule : IHttpModule
{
public void Dispose()
{
throw new NotImplementedException();
}
public void Init(HttpApplication context)
{
context.PostRequestHandlerExecute += delegate(object sender, EventArgs e)
{
System.Diagnostics.Trace.WriteLine("hello");
};
}
}
I see new "he...
Hi,
I have a custom HTTP Module. I would like to inject the logger using my IoC framework, so I can log errors in the module. However, of course I don't get a constructor, so can't inject it into that. What's the best way to go about this?
If you need the specific IoC container - I'm currently using Windsor, but may soon move to Aut...
I am trying to log the contents of an http request, using an IHttpModule like so:
public class LoggingModule : IHttpModule
{
public void Init(HttpApplication context)
{
context.BeginRequest += ContextBeginRequest;
}
private void ContextBeginRequest(object sender, EventArgs e)
{
var request = ((HttpAp...
I have an httpmodule that reads from a csv file for redirection rules.
However, since it's an httpmodule and it is checking on every request, I obviously don't want to read the file every time.
What are some strategies to cache the rules (in an in Array) so that I do not have to read the file on every request?
Update: Using .NET 2.0
...
Hello everyone,
I am using VSTS 2008 + C# + .Net 3.5 + IIS 7.0 to develop an ASP.Net web site. I want to develop an Http module, which could inspect whether incoming request has some specific http header (e.g. CustomerID) and if do not have such header, I will redirect user request to some other pages.
I think I should develop by using...
Anyone got an idea of how to render an aspx page inside of an HttpModule and stream it back to the browser?
...
We've got hudrends of ASPX and HTML file in our site, and would like to inject a small JavaScript at the end of each file. If I wanted to do this using and HttpModule (trying to learn something new), would this do--are there any glaring problems?
public void Init(HttpApplication context)
{
context.BeginRequest += new EventHandler(co...
In an HttpModule, I'd like to intercept the Response after the HttpResponse.Headers collection has been set but before the body of the Response has been added to the Response Stream. Would this be on the HttpContext.Current.PreSendRequestContent event?
...
I've implemented an HttpModule that intercepts the Response stream of every request and runs a half dozen to a dozen Regex.Replace()s on each text/html-typed response. I'm concerned about how much of a performance hit I'm incurring here. What's a good way to find out? I want to compare speed with and without this HttpModule running.
...