I have written an HttpModule that spawns a background thread. I'm using the thread like a Scheduled Task that runs in-process, which is really handy.
What are best practices for keeping track of this thread? I've never done this before, and I'm a little confused about some aspects of it:
How do I know if the thread is still running...
I have an HttpModule that has bound an event handler to EndRequest.
Is there any way to handle the request inside the event handler? Meaning, I don't just want to run code and keep the request moving -- I want to stop it dead in its tracks, return a 200 Status Code, and call it a day, without it request continuing to the next step in t...
Hi,
I want to integrate some http modules in my asp.net application (v 3.5, visual studio 2008) and I'm not sure how to debug or use such modules while debugging in the asp.net development server that fires when I run the web app.
Do I need to include the module source in the solution or can I just drop the DLL into BIN? I'm from the 1...
From an HTTP module, is there a way to persist something in the Request to be accessed by a mater module or the eventual handler? Can you "stick" something on the Request as it passes through that will still be there later in the pipeline?
...
When working with HTTP modules, has anyone noticed that the final two events in the pipeline -- PreSendRequestHeaders and PreSendRequestContent -- don't always run?
I've verified that code bound to EndRequest will run, but will not when bound to either PreSendRequestHeaders or PreSendRequestContent.
Is there a reason why? I thought pe...
I would like to register an HttpHandler to include all subfolders of a root folder regardless of how far down they are nested. I would have expected the behavior with the below code to do just that but in fact it only includes items directly in the root folder.
<httpHandlers>
<add verb="*" path="root/*" type="HandlerType, Assembly" /...
I have a masterpage which is set via a HTTPModule on PreInit(). HAPPY TIME! Problem is I need to override the masterpagefile value on a few pages due to a layout issue. Anyone know the best way?
I tried adding a Page_Preinit on my page, but it is executed before the PreInit() in my module, so it ends up being reset there. I'm thinki...
Hi,
I've developed a simple file browsing HTTP module which uses virtual paths (i.e. paths that do not actually exist on the disk). The app. runs fine on my IIS 7, but on Win 2003 the IIS does not forward the HTTP requests to my Web. application - instead it just returns "The page cannot be found" to the browser.
How do I disable this ...
In an HttpModule, I put an Item in the Context, like this:
HttpContext.Current.Items.Add("MyKey", "Hello world!");
Directly under this code (still inside the module), I can retrieve this string from the collection, so I know it got added.
Fast forward to my actual handler (a Web form -- .aspx). I try to get this item back:
string my...
My question is simple (although the answer will most likely not be): I'm trying to decide how to implement a server side upload handler in C# / ASP.NET.
I've used both HttpModules (IHttpModule interface) and HttpHandlers (IHttpHandler interface) and it occurs to me that I could implement this using either mechanism. It also occurs t...
I have an HttpModule that displays images that follow a certain URL pattern. For example, /images/employees/jason.jpg is handled by the module, but all other images aren't. It works just fine on my local machine (Cassini and IIS 7). However, the IIS6 production server isn't working. I've had the hosting company map the images to the ASP....
Hello,
Q1) Assuming Http module is registered with IIS7 to be used for non-Asp.Net application ( say some Java app ) , when in the request’s life cycle will IIS7 invoke this module? Thus, how will IIS7 decide when to invoke it?
Q2) In order to register Http module with IIS7, we need to put it in GAC.
Is it possible to register H...
Hello,
FormsAuthenticationModule is used for tracking user and role information using encrypted cookie.
But does this module also contain code that actually detects whether user requesting web page has forms authentication ticket and if not, redirects user to login page, or is it actually UrlAuthorizationModule that tells FormsAuthe...
A customer is asking if there is anything we can do to remove "/Pages" from his Internet-facing MOSS publishing site. Some Googling reveals that some clever use of HTTPModules may be able to hide the presence of Pages, but I've yet to see an end-to-end working solution. Have any of you come up against this particular requirement, and i...
How do I find out from within an HttpModule what domain made a particular request?
Say I only want to allow site1.com and site2.com to use images from my server, how do I check that it is them making the request?
...
I've created an HttpModule in ASP.NET to allow users to upload large files. I found some sample code online that I was able to adapt for my needs. I grab the file if it is a multi-part message and then I chunk the bytes and write them to disk.
The problem is that the file is always corrupt. After doing some research, it turns out t...
I have a custom handler that is returning an image to the browser.
The images are fetched from a database.
For some reason the images are not being cached by the browser, and I was wondering if someone might be able to spot what I am missing from the below code:
HttpContext.Current.Response.BinaryWrite(imageBytes);
HttpContext.Current...
I am using an HttpModule to do some URL shortening on my site. I am using Visual Studio 2008 and IIS 7, and .Net 3.5.
When the module is specified in the system.webServer element of web.config, and the site is run in IIS, it works fine. The config looks like this:
<system.webServer>
<modules>
<add name="MinimizeModule" type=...
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...
I have statiс files in website folder, but need to check permissions for every file.
I decided to use HttpModule for that purposes.
ASP.NET receives all the http-requests (I used wildcard mapping) and
The algorith is the following:
HttpModule receives the request
HttpModule checks permissions
If access is denied then the answer is ...