httpmodule

IHttpHandler vs IHttpModule

六眼飞鱼酱① 提交于 2019-11-28 02:54:47
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 to me that I don't understand the differences between the two. So my question is this: In what cases would I choose to use IHttpHandler instead of IHttpModule (and vice/versa)? Is one executed much higher in the pipeline? Is one much easier to configure in certain

Why HttpContext.Current.Handler is null?

大城市里の小女人 提交于 2019-11-28 00:53:18
问题 I'm trying to access a Page within an HttpModule and I think I should do this by calling HttpContext.Current.Handler (This should reference the current page) but I'm getting null all the time. I'm developing using .Net 3.5 framework. I'm checking this on AuthorizeRequest and AuthenticateRequest Thanks. 回答1: Probably, the request has not been handed out to a handler yet (for example, you're in BeginRequest ). 回答2: In AuthorizeRequest and AuthenticateRequest , the handler has not been created

httpModules not working on iis7

时光总嘲笑我的痴心妄想 提交于 2019-11-27 23:19:19
问题 I have the following module public class LowerCaseRequest : IHttpModule { public void Init(HttpApplication context) { context.BeginRequest += new EventHandler(this.OnBeginRequest); } public void Dispose() { } public void OnBeginRequest(Object s, EventArgs e) { HttpApplication app = (HttpApplication)s; if (app.Context.Request.Url.ToString().ToLower().EndsWith(".aspx")) { if (app.Context.Request.Url.ToString() != app.Context.Request.Url.ToString().ToLower()) { HttpResponse response = app

How to analyze the performance of requests in ASP.NET MVC application?

[亡魂溺海] 提交于 2019-11-27 22:26:33
I would like to capture the hit time, processing time, memory consumption and response time of requests in ASP.NET MVC application. Is there any way or tool to perform this? Check the miniprofiler , developed by the stackoverflow team http://code.google.com/p/mvc-mini-profiler/ This helps you to do some analysis. There is a nuget pacakge available which you can use to add this to your project. Scott has written a post about how to use that. You can also look into Glimpse . There are commerical products to do memory and performance profiling like telerik just trace . You can download their

How to register HttpHandler for all subfolders in Asp.Net?

≯℡__Kan透↙ 提交于 2019-11-27 18:11:27
问题 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" /> </httpHandlers> I can of course register as below to include anything that is second tier, however have yet to encounter a way to just say anything below root.

Hook into Application_Start in a HttpModule

我的梦境 提交于 2019-11-27 16:22:54
问题 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 an HttpModule? Update: I’ve come to simple solution using the Init event instead, but it still smells a bit funny to me. 回答1: You CAN use HttpModule to handle

HTTP module vs action filter in asp.net-mvc

空扰寡人 提交于 2019-11-27 14:38:27
问题 I am developing an application in asp.net MVC3 and I have the following questions: When should I write an HTTP module and when should I write an action filter? 回答1: Filter are more MVC approach of doing thing whereas Http Module are more of ASP.NET way of doing thing. Both serve similar purpose by providing hook in the processing pipline. HttpModule is more generic and when you want some thing to be processed on every request. Filters are useful for adding action specific behaviour. If you

Programmatically register HttpModules at runtime

こ雲淡風輕ζ 提交于 2019-11-27 11:12:54
I'm writing an app where 3rd party vendors can write plugin DLLs and drop them into the web app's bin directory. I want the ability for these plugins to be able to register their own HttpModules if necessary. Is there anyway that I can add or remove HttpModules from and to the pipeline at runtime without having a corresponding entry in the Web.Config, or do I have to programmatically edit the Web.Config when adding / removing modules? I know that either way is going to cause an AppDomain restart but I'd rather be able to do it in code than having to fudge the web.config to achieve the same

Could not load file or assembly 'msshrtmi' or one of its dependencies (Azure Table Storage Access)

跟風遠走 提交于 2019-11-27 10:15:32
问题 I have an HTTPModule that I use to redirect traffic between a website in my data center and a website running on the Azure platform. This HTTPModule retrieves its redirect rules from Azure Table Storage. Redirects work fine on my local dev machine as well as when running on Azure. However, when I deploy the module to my data center servers ( IIS 7, WS 2008 R2 Standard 64bit, .NET 4.0, ASP.NET 4.0 ) I receive the following error Parser Error Message: Could not load file or assembly 'msshrtmi'

HTTP handler vs HTTP module

心不动则不痛 提交于 2019-11-27 10:07:06
Can someone explain in less than 2 sentences the difference between both? Yes, I know google can provide hundreds of answers but not one in 2 clear sentences:) HttpHandler is where the request train is headed. HttpModule is a station along the way. Jon Galloway The two sentences: An HttpModule will execute for every request to your application, regardless of extension, and is generally used for things like security, statistics, logging, etc. An HttpHandler is generally associated with a specific extension, and is used for things like RSS feeds, dynamic image generation or modification, and the