Why is Global.asax is used?

  1. Implement application and session level events

  2. Declare Global variables

  3. No use


Correct Option: A

AI Explanation

To answer this question, let's go through each option to understand why it is correct or incorrect:

Option A) Implement application and session level events - This option is correct. The Global.asax file is used in ASP.NET applications to handle application-level events, such as Application_Start, Application_End, Session_Start, Session_End, etc. These events allow you to run code at specific points during the application's lifetime, such as initializing global variables, setting up database connections, or managing session variables.

Option B) Declare Global variables - This option is incorrect. While it is possible to declare global variables in the Global.asax file, it is not the primary purpose of this file.

Option C) No use - This option is incorrect. The Global.asax file serves a specific purpose in ASP.NET applications, as mentioned in Option A.

The correct answer is A) Implement application and session level events. This option is correct because the Global.asax file is primarily used to handle application-level events and manage session-related tasks.

Find more quizzes: