httpapplication

AuthenticateRequest event

故事扮演 提交于 2020-01-09 03:02:14
问题 Q 1. To my understanding FormsAuthenticationModule is subscribed to AuthenticateRequest event, and thus only after this event is fired, is FormsAuthenticationModule called. But the following quotes got me a bit confused: The AuthenticateRequest event signals that the configured authentication mechanism has authenticated the current request. Doesn’t the above quote suggest that when AuthenticateRequest event is raised, request (aka user) is already authenticated? Subscribing to the

Application_Start versus OnInit versus constructor

大城市里の小女人 提交于 2019-12-23 09:26:10
问题 I've gone rounds with this ever since I started programming classic ASP 12 (or so) years ago and I've never found a great solution because the architecture of ASP and ASP.NET has always been a swamp of bad practices, magic shared singletons, etc. My biggest issue is with the HttpApplication object with its non-event events ( Application_Start , Application_End , etc.). If you want to do stuff once for the entire lifespan of an HTTP application, Application_Start is the obvious place to do it.

Why is HttpApplication constructor called several times

喜夏-厌秋 提交于 2019-12-20 17:25:18
问题 Can somebody explain why the constructor of a custom class derived from HttpApplication is called several times upon application startup? My code structure is the following: - My Global class in global.asax derives from CustomApp class. - The CustomApp class derives from HttpApplication class The Global class is created at startup, but when I place a breakpoint in the constructor, it is invoked several times! I thought there should be only one instance of Application class created? Am I wrong

Running my HttpApplication in my own AppDomain

走远了吗. 提交于 2019-12-11 04:36:25
问题 I'm looking for a way to run my HttpApplication in an AppDomain I created myself programmatically. as the AppManagerAppDomainFactory is a sealed class, I wondered if there was a way to implement my own IAppManagerAppDomainFactory without having to patch IIS. If you're interested and want to know more I suggest this article Thanks for your suggestions (even if I don't think I'll get a acceptable answer ^^) 来源: https://stackoverflow.com/questions/6663841/running-my-httpapplication-in-my-own

Do asynchronous HttpApplication events wait until they return?

吃可爱长大的小学妹 提交于 2019-12-10 09:47:28
问题 To what extent are HttpApplication async events (eg those registered using AddOnEndRequestAsync and friends) asynchronous? Does IIS wait for all asynchronous events fired for a particular event to complete before moving onto the next event, or are they 'fire and forget'? 回答1: It's not clear to me the exact workings when running in integrated pipeline mode, but I can tell you what I see for the non-integrated case, and the semantics should remain the same. The short answer is that each event

Unit testing an HttpApplication

僤鯓⒐⒋嵵緔 提交于 2019-12-08 23:27:41
问题 I have a class derived from HttpApplication that adds some extra features. I'm to the point where I need to unit test these features, which means I have to be able to create a new instance of the HttpApplication, fake a request, and retrieve the response object. How exactly do I go about unit testing an HttpApplication object? I'm using Moq at the moment, but I have no idea how to set up the required mock object. 回答1: Unfortunately, this isn't particularly easy to do, as the HttpApplication

Do asynchronous HttpApplication events wait until they return?

丶灬走出姿态 提交于 2019-12-05 21:21:19
To what extent are HttpApplication async events (eg those registered using AddOnEndRequestAsync and friends) asynchronous? Does IIS wait for all asynchronous events fired for a particular event to complete before moving onto the next event, or are they 'fire and forget'? It's not clear to me the exact workings when running in integrated pipeline mode, but I can tell you what I see for the non-integrated case, and the semantics should remain the same. The short answer is that each event handler is fired in series, whether synchronous or asynchronous, and the next is not fired until the previous

Application_Start ASP.NET

吃可爱长大的小学妹 提交于 2019-11-30 09:32:51
If get this from the Microsoft official documentation : The Application_Start and Application_End methods are special methods that do not represent HttpApplication events. ASP.NET calls them once for the lifetime of the application domain, not for each HttpApplication instance. I was sure that Application_Start was related to the HttpApplication, here this guy explains why I was wrong. Which object/entity is related to the Application_Start event? As the documentation says, the events are linked to the lifetime of the application domain , which in practice means the app pool which the

Unit testing an HttpApplication

时光毁灭记忆、已成空白 提交于 2019-11-30 08:48:43
I have a class derived from HttpApplication that adds some extra features. I'm to the point where I need to unit test these features, which means I have to be able to create a new instance of the HttpApplication, fake a request, and retrieve the response object. How exactly do I go about unit testing an HttpApplication object? I'm using Moq at the moment, but I have no idea how to set up the required mock object. Unfortunately, this isn't particularly easy to do, as the HttpApplication doesn't lend itself to mocking very easily; there is no interface to mock against and most of the methods

Application_Start ASP.NET

浪子不回头ぞ 提交于 2019-11-29 14:38:47
问题 If get this from the Microsoft official documentation: The Application_Start and Application_End methods are special methods that do not represent HttpApplication events. ASP.NET calls them once for the lifetime of the application domain, not for each HttpApplication instance. I was sure that Application_Start was related to the HttpApplication, here this guy explains why I was wrong. Which object/entity is related to the Application_Start event? 回答1: As the documentation says, the events are