InternetUnicodeHTMLCSSScalable Vector Graphics (SVG)Extensible Markup Language (xml) ASP.Net TOCASP.NetMiscellaneous FeatureASP.NET ScriptingASP.NET Run-time Object.NET Component Classic ASP Platform Application and Session Draft for Information Only
ContentASP.NET Application
ASP.NET ApplicationApplication ClassAn application class is defined in the Global.asax file. The code in Global.asax defines a new class that is derived from System.Web.HttpApplication. In the absence of a Global.asax file, the base class, HttpApplication, is used as the application class. Application InstanceThe ASP.NET runtime creates as many instances of application classes as needed to process requests simultaneously. For most applications, this number is limited to the number of threads and remains in the range of 1 through 100, depending on the hardware, server load, configuration, and so on. Many requests reuse application instances, and a free list of application instances is kept during periods of reduced load. Application instances are used in a thread-safe manner, that is, one request at a time. This has important implications:
Because static members of any class, including an application class, are not thread-safe, the user code must provide appropriate locking for access to static members. This applies to any static member that you add to the application class. Use the following guidelines to access the application instance that is associated with the current request:
Because Application is used to refer the global application state in classic ASP, ASP.NET uses ApplicationInstance and not Application as a property name of HttpContext to refer the application instance of HttpApplication that processing the current request. Application EventsHttpApplication ClassHttpApplication EventIn ASP.NET, an typical application request consists of a series of the application events
Note: If you use Server.Transfer or Response.Redirect(string), the current request is effectively interrupted and some of the events that are listed above will not be raised. However, the EndRequest event will be raised in this scenario. The following items can handle these events:
Each event can have synchronous and asynchronous subscribers. Asynchronous subscribers are executed first. Not all events are always executed; the only event that is always executed is EndRequest. As a result, perform all after-request cleanup in the EndRequest event. Note In most cases, the actual response is sent to the client after the application instance is finished with the response (which is after EndRequest). IIS 5.0 and 6.0For IIS 5.0 and 6.0, the application events handled by HttpApplication class are
IIS 7.0For IIS 7.0, the application events handled by HttpApplication class are
Note: The MapReNote: The MapRequestHandler, LogRequest, and PostLogRequest events are supported only if the application is running in Integrated mode in IIS 7.0 and with the .NET Framework 3.0 or later. Application_OnStart and Application_OnEndASP.NET introduces the unique Application_OnStart and Application_OnEnd "events" for compatibility with classic ASP. These "events" are executed only once in the lifetime of an application and not for every application instance. Therefore, if you change non-static members in these methods, you affect only one application instance and not all instances. You can initialize one application instance either in the constructor or by overriding the Init method. Application_OnStart is a logical equivalent to the class constructor for the application class, but it offers one advantage: the code has access to the HttpContext for the first request to the application. Application StateApplication state is a global dictionary of late-bound objects, which classic ASP introduces to compensate for the absence of global variables in Microsoft Visual Basic Scripting Edition (VBScript). In ASP.NET, you can access application state through one of the following:
ASP.NET includes application state primarily for compatibility with classic ASP so that it is easier to migrate existing applications to ASP.NET. It is recommended that you store data in static members of the application class instead of in the Application object. This increases performance because you can access a static variable faster than you can access an item in the Application dictionary. To access static application members from pages in Microsoft Visual C# .NET and Microsoft Visual Basic .NET, you must use the ClassName attribute in Global.asax to name your application class. For example:
If a static member is named MyStaticMember in your Global.asax file, you can use MyClass.MyStaticMember to access it from your page.
References
©sideway ID: 190600011 Last Updated: 6/11/2019 Revision: 0 Ref: ![]() References
![]() Latest Updated Links
![]() ![]() ![]() ![]() ![]() |
![]() Home 5 Business Management HBR 3 Information Recreation Hobbies 8 Culture Chinese 1097 English 339 Travel 18 Reference 79 Computer Hardware 254 Software Application 213 Digitization 37 Latex 52 Manim 205 KB 1 Numeric 19 Programming Web 289 Unicode 504 HTML 66 CSS 65 SVG 46 ASP.NET 270 OS 431 DeskTop 7 Python 72 Knowledge Mathematics Formulas 8 Set 1 Logic 1 Algebra 84 Number Theory 206 Trigonometry 31 Geometry 34 Calculus 67 Engineering Tables 8 Mechanical Rigid Bodies Statics 92 Dynamics 37 Fluid 5 Control Acoustics 19 Natural Sciences Matter 1 Electric 27 Biology 1 |
Copyright © 2000-2025 Sideway . All rights reserved Disclaimers last modified on 06 September 2019