httpmodule

Execute HtttModule for extionsionless URL only

I have an httpModule which has to run before an ActionMethod. I dont want that it is executed when a request for an image comes in. For some reasons I realy need an HttpModule and cant use an ActionFilter What is the way to do this? public class PostAuthenticateModule : IHttpModule { public void Init(HttpApplication app) ...

How to use the Request URL/URL Rewriting For Localization in ASP.NET - Using an HTTP Module or Global.asax Code

I wanted to see if there is a way to use the request URL/URL rewriting to set the language a page is rendered in by examining a portion of the URL in ASP.NET. We have a site that already works with ASP.NET’s resource localization and user’s can change the language that they see pages/resources on the site in, however the current mechani...

Why is HttpContext.Current.Session available in HttpModule but not in Response.Filter?

I have written an HttpModule that adds a response filter. The filter is capturing page output and storing it in a session variable. I am able to access HttpContext.Current.Session in my HttpModule. The HttpModule is handling the PostAcquireRequestState event. I am still able to access HttpContext.Current.Session in the PostAcquireReque...

How to make from your Custom HTTP Module a stand alone HTTP server?

How to make from your Custom HTTP Module a stand aloun TCP\HTTP server capable of for example runing near to any other HTTP server (on same port, just taking some URL namespace like www.example.com/myModule/blabla?id=anyID, and not beeng rood to my other servers like apache HTTP server with PHP (so I can steel call it www.example.com/myA...

ASP.Net HttpModule List<> content

We have created an http module that loads data on initialize into a list, and uses that list on every endrequest event of application. However we got a null reference exception on the module at endRequest event complaining that the content is null. Yet we are sure that at module initialization we have put non-null objects correctly. How...

Is HttpModule shared among working threads?

Do I have to lock access to instance members? Example: public class HttpModule : IHttpModule { //... Dictionary<int, int> foo; void UseFoo(int a, int b) { foo[a] = b; } } ...

Custom basic authentication fails in IIS7

I have an ASP.NET MVC application, with some RESTful services that I'm trying to secure using custom basic authentication (they are authenticated against my own database). I have implemented this by writing an HTTPModule. I have one method attached to the HttpApplication.AuthenticateRequest event, which calls this method in the case of...

asp.net ajax + http module fails

Hi, I am trying my hands on asp.net+ajax+httpmodule. My Form <form id="LoginForm" runat="server"> <asp:ScriptManager ID="LoginScriptMgr" runat="server"></asp:ScriptManager> <asp:UpdatePanel ID="LoginPanel" runat="server"> <ContentTemplate> <asp:Label ID="lblLoginHeader" Text="Login" runat="server"></asp:Label> <asp...

SharePoint 2010 HttpModule problem

I'm trying to write an HttpModule to run on our SharePoint farm - essentially it will check whether the user is authenticated and if they are it will validate some info against another database and potentially redirect the user to sign a variety of usage agreements. Whenever I enable the module in the web.config I'm finding that SharePo...

Keep an object for the time the connection is running in ASP.NET

Hi, I'm developing a web service with ASP.NET, is not an .asmx or WCF, it's a custom one, so I'm working with the Http classes (context, request, response, etc..). Session is disabled. I'm working with my own handler and module. I'd like to keep a object alive and accessible for the time the connection is alive. I mean, a request enter...

VS2010 development web server does not use integrated-mode HTTP handlers/modules

I am developing an ASP.NET MVC 2 web site, targeted for .NET Framework 4.0, using Visual Studio 2010. My web.config contains the following code: <system.webServer> <modules runAllManagedModulesForAllRequests="true"> <add name="XhtmlModule" type="DomenicDenicola.Website.XhtmlModule" /> </modules> <handlers> <...

Is it possible to create a http module without making an entry into the web.config or GAC?

The title is my question at this point. Is it possible to create an http module without making an entry into the web.config or GAC? ...

Hook into Application_Start in a HttpModule

I’m implementing a simple HttpModule, where I want some code to run when the web application is started. But I’m surprised to find that the Application_Start event I would normally use from Global.asax is not available from a HttpModule. Is that correct, or am I missing something here? How do I hook into the Application_Start event from...

retreive the url of the page an image sits on

I'm trying to log URLs that access broken images, using an HTTP module to catch those images when accessed. How do you retrieve the URL where that image sits on? is there a way to do it the other way round too? That is, loop through images served in a URL and decide which ones are broken. This is all in ASP.NET with C#. ...

How to keep alive an HttpModule (a.k.a register it as a singleton)

I pretty sure I've seen this somewhere but I can't seem to find it anywhere. I have an HttpModule that can be used across multiple requests. In other words instead of creating a new instance of the Module on every request it only ever needs to create it once. Does this ring a bell to anyone? If so, what's the method for configuring to wo...

How could I insert a string into the response stream anywhere I want?

There may be an easy way to do this but I can't see it... I created a simple Http Module that starts a timer on the PreRequestHandler and stops the timer on the PostRequestHandler to calculate the time it took the page to load. I then create some simple html and write my results to Response.Write. Since I'm doing this in the PostReque...

AJAX Partial Rendering issues for the default page in IIS 7 when using custom http module

The problem When I try to make a AJAX partial update request (using the UpdatePanel control) from the default page of an IIS7 web site, it fails- instead of returning the html to be updated, it returns the entire page, which then causes the MS AJAX Javascript to throw a parsing shit-fit. The suspected cause I have narrowed the cause d...

Possible to map a new file extension to an existing handler in ASP.NET?

I have a scenario where my application is going to be publishing services that are consumed by both PC's and mobile devices, and I have a HTTPModule that I want to only perform work on only the mobile requests. So I thought the best way of doing this was to point the mobile requests to a different file extension and have the HTTPModule ...

When the target of a .NET HttpModule RewritePath call is a PHP file the $_POST array is empty

Hello friends. We have an application running on IIS 6 which uses a custom HttpModule to rewrite urls. This works great (well done us) except in the case where the Context.RewritePath destination is a .php file. The php file is executed as expected, however the $_POST collection is empty meaning it cannot access any forms which are subm...

Using Http module for authorization AuthorizeRequest or BeginRequest

I have a wap site with susciription and I want to check if users are authorized to see some pages. I have decided to use http module. Should I use AuthorizeRequest or BeginRequest to check the users status? and why? ...