Questions tagged [ihttpmodule]
121 questions
3
votes
1 answer
How can I generate a 404 response from an IHttpModule configured in the global web.config?
I'm trying to generate a 404 response for certain requests on all sites on a server based on the HttpRequest.UserAgent.
I've configured an IHttpModule in the server's global web.config containing the code below:
private void…

mike
- 7,137
- 2
- 23
- 27
3
votes
2 answers
Accessing the Form collection in an IHttpModule causes event Handler not to get called on Default page
Ok, this is a weird one. I've created a simple sample site to demonstrate the issue. In it, I have a Default.aspx Page that has a button on it:
BFree
3
votes
0 answers
How do I get a IHttpHandler to do authentication properly?
I have some IHttpHandler implementations where they may optionally have authentication applied to them.
I originally rolled my own Basic authentication but would now like to use IIS's capabilities so that the deploying user can control what type of…

RobV
- 28,022
- 11
- 77
- 119
3
votes
2 answers
export data from WCF Service to excel
I need to provide an export to excel feature for a large amount of data returned from a WCF web service.
The code to load the datalist is as below:
List r = myObject.ReturnResultSet(myWebRequestUrl); //call to WCF…

Dave
- 4,038
- 9
- 45
- 57
3
votes
2 answers
Sitecore HttpModules being initialized second time
We are experiencing CPU peaks on sudden moments. After checking our Sitecore logs, I have noticed that there are a lot of log entries with "11:49:26 INFO HttpModule is being initialized" . As far is know this should only be initialized on the…

Identity
- 1,553
- 1
- 22
- 44
3
votes
2 answers
HttpModule - need to redirect the user to a specific page when OnError hits
This is my first time working with HttpModules. I need to create a "drag and drop" sort of solution into existing ASP.NET applications that will provide common error handling by redirecting the users to a new "ErrorFeedback.aspx" page. So, when an…

Mike Marks
- 10,017
- 17
- 69
- 128
3
votes
1 answer
SharePoint 2013, custom IHttpModule NullReferenceException
Update: Problem solved. Read on.
Any idea why it's apparently not possible anymore to add custom IHttpModules?
My question is related to: HttpModule.Init - safely add HttpApplication.BeginRequest handler in IIS7 integrated mode
However this question…

lapsus
- 2,915
- 2
- 32
- 61
3
votes
1 answer
ASP.Net MVC AsyncController log request processing time
I need to get request processing time for asp.net MVC. i use IHttpModule subscribing for onBeginRequest and onEndRequest events. For sync controllers it works great but for async it returns wrong result(for example 20ms when real time was about…

VladK
- 105
- 7
3
votes
1 answer
Logging raw and compressed HTTP responses in ASP.NET & IIS7
Along the lines of this question I want to create a HttpModule that will do some custom logging of requests and responses for us. Using the code in the most popular answer for that question I've got a HttpModule up and running which does indeed…

Chris
- 3,081
- 3
- 32
- 37
2
votes
3 answers
HttpModule not receiving cookies on IIS 6
I have an HttpModule that I created and am running on IIS 6 using Windows Server 2003. I can send cookies to the browser, but I can not read them on the next request, cookie is always null.
If I run this module on IIS 7 though, it works just fine.…

James
- 680
- 2
- 8
- 22
2
votes
3 answers
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 so all errors are promoted to the browser.
Although the…
Unknown
2
votes
2 answers
NTLM Authentication. Can't get it to work in an IHttpModule. AcceptSecurityContext always fails
Here's the setup. On an ASP.Net site, we want to have NTLM authentication on specific pages. The way this will work is there will be a module that will only respond to those pages, and then do the back and forth request/response required for NTLM…

BFree
- 102,548
- 21
- 159
- 201
2
votes
1 answer
Static files and authentication in ASP.net
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…

El Che
- 1,301
- 3
- 15
- 33
2
votes
0 answers
C# HTTPModule Could not load type CGI Request
Trying to use a HTTPModule I wrote in complied C# class project to log request values and extend a third party CGI shopping cart. My module works fine with asp,asp.net,jpg and html request, but soon as I request the store.cgi, I get the following…

motogeek
- 96
- 1
- 4
2
votes
1 answer
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…

JD Conley
- 2,916
- 1
- 19
- 17