ihttpmodule

Error handling implemented by IHttpModule doesn't work in IIS6, works in IIS5.1

Hi, I implement common error handling by using IHttpModule. Locally on my machine with WinXP it works like a charm. Once I upload solution on our test server, which is W2003 it doesn't work. Once an error occurs it displays directly in an asp.net error page. It doesn't process using my error module. Any suggestion most welcome....X. ...

How to get data from an IHttpModule to the ASP.NET MVC RequestContext?

I've got a custom IHttpModule that does authentication (to Facebook, Myspace, etc). It raises an event that can be handled in the HttpApplication instance with details about the user. It's a lot like the OnAuthenticate event that the FormsAuthenticationModule raises. From the HttpApplication class, where should I place this information ...

Using IHttpModule Over Global.asax

I've been given the thrilling task of re-writing our exception handling system. Whilst I will state that handling exceptions from an application-wide point of view isn't something we want, typically it's unavoidable when our team are understaffed for the sheer amount of work we need to push out the door, so please, no flaming the global...

Static files and authentication in ASP.net

Hi! Say I have a virtual folder /topFolder/ in IIS7, and in that folder there can be any file that can be displayed in a browser (xml, html, swf, doc etc - typically "unmanaged" resources from the IIS perspective). Before giving the request permission to open any file below the folder, I need to check some session variables in order to...

How2: what event to hook in HttpModule for putting js links into head element

I want to have HttpModule to inject javascripts, css links into HEAD element from some simple config data. I am not sure which event I should hook? Curently I use - context.PreRequestHandlerExecute for changing the masterpage dynamically - Context.BeginRequest for SEO optimalization There is some help at http://stackoverflow.com/ques...

Disabling HttpModule on certain location

I know that this has already been asked here but the answer (using a handler instead) doesn't solve the issue, as I'm using a third party component that doesn't implement IHttpHandler. So, again, is there any way to load/unload a HttpModule on a certain request? EDIT: I forgot to mention that we're working with .NET 2.0. I'm sorry abo...

StatusCode in IHttpModule is always 200?

I have an custom IHttpModule that handels all available events and logs the HttpContext.Current.Response.StatusCode to a file. My web.config does not contain any other module in <httpModules> so all errors are promoted to the browser. Although the Browsers shows a 404, the log file is full of 200 (Ok) entries and not a single 404. Wh...

Logging raw HTTP request/response in ASP.NET MVC & IIS7

I'm writing a web service (using ASP.NET MVC) and for support purposes we'd like to be able to log the requests and response in as close as possible to the raw, on-the-wire format (i.e including HTTP method, path, all headers, and the body) into a database. What I'm not sure of is how to get hold of this data in the least 'mangled' way...

My UrlRewrite IHttpModule remove my second QueryString

Hello, I have a custom url rewriter function that works fine. But when i are going to use a second querystring on my url, that remove the second querystring. my friendly url: /gallery/view-ablum/?q=1 i the code: Page.aspx?id=22&q=1 , when i have past RewritePath(...) the remove &q=1 from my real page. I don't now who to fix this, i can...

ASP.NET Webforms IHttpModule Singleton

I have a class that implements IHttpModule in a separate assembly from a website. The module implementation intercepts requests and rewrites urls for the website. The mappings are stored in a class with the requested url and the destination url. Is the second example, MTSingleton, from http://devhood.com/Tutorials/tutorial_details...

HTTPModule and Sharepoint Site

Hello All, I am running into an issue with using a HTTPModule with a sharepoint deployed site. Here is what I have: my asp.net pages inside the /layouts/[ProjectName]/ folder. The aspx file uses a sharepoint masterpage i have a HTTPModule and implments IHTTPModule the web.config contains {httpModules} {add name="HTTPModule" type="H...

JS,Images and CSS getting intercepted by HTTPModule

I have a simple HTTPModule which does some custom session state management. public void Init(HttpApplication context) { context.AcquireRequestState += new EventHandler(ProcessBeginRequest); ActivityLogger.LogInfo( DateTime.UtcNow.ToLongTimeString() + " In Init " + HttpContext.Current.Request.Url.AbsoluteU...

IHTTPModule perfomance hit?

I'm implementing an IHttpModule as described in this question. Since we're examining every request, I'm worried there may be a performance hit. Has anyone run into performance issues implementing IHttpModules? ...

Detect mapped virtual directories from an ihttpmodule in a c# .net application

I have a .net website which contains an IHttpModule I wrote to do certain tasks (authorisation etc). But within the website there are a number of virtual directories that are mapped to third party applications which unfortunately I can't change or move (e.g. community server forums, adxstudio cms and others). I am looking for a way to p...

Changes in Page Object in HttpModule is not working/effecting output

I am trying to access the page object in module and change the hyper links urls. Page object is being access properly, but changes I am making are not effecting the output. I mean here I am changing the url to TestURL.aspx, but this is not comming. could anyone help me in this please? namespace Dutt.PageURLBuilder { class PageURLMod...

Can I get read access to the HTTP output stream in ASP.NET?

I would like to read all content that's been written to the output stream. I'm attempting to do this using an HTTP module, and it seems like the obvious timing would be when handling the PreSendRequestContent event. However, if the output stream seems to be set to write-only, as I can't read using a StreamReader. Is there a way I read a...

json ihttpmodule compression

Hi, I wrote an IHttpModule that compress my respone using gzip (I return a lot of data) in order to reduce response size. It is working great as long as the web service doesn't throws an exception. In case exception is thrown, the exception gzipped but the Content-encoding header is disappear and the client doesn't know to read the excep...

Are HttpModules utilized when a .Net web service is called through the javascript proxy (AJAX)?

I am making our large set of web services available to AJAX calls. I have added the [System.Web.Script.Services.ScriptService] to each service. We have a registered HttpModule that initializes some objects we use regularly for logging and internationalization in the IHttpModule.Init override. It appears that the IHttpModule.Init is calle...

How to manipulate a header and then continue with it in C#?

Hi all, I want to replace an old ISAPI filter that ran on IIS6. This filter checks if the request is of a special kind, then manipulates the header and continues with the request. Two headers are added in the manipulating method that I need for calling another special ISAPI module. So I have ISAPI C++ code like: DWORD OnPreProc(HTTP_FIL...

Frame Redirect in C#

I would like to execute a frame redirect in C# from my managed module for the IIS 7. When I call context.Response.Redirect(@"http://www.myRedirect.org");the correct page is shown but also the address is shown in the browser. And that is exactly what I do not want. So I want something like: private void OnBeginRequest(object sender, Even...