You must Sign In to post a response.
  • Category: ASP.Net MVC

    About the mvc for a basic concept

    what is the exact use of Global.asax in mvc?
  • #766353
    Global.asax is a file which contains code for handling application level events. It resides in the root directory of an application.
    <ul><li>As far as ASP.NET MVC application is considered, you can use Global.asax file for 'ASP.NET routing' i.e. map incoming requests from browser to specific MVC controller actions.
    Please find a sample code for this:
    <li>Also for application level error handling. Please find a code for this over here:

  • #766357

    Global.asax file is used to Handle application level activities like error handling application start and end as well as session start and end everything we can handle in global.asax file.

    This is the file loading first while execute the application, and initialize Application level components, in a single project you can have only one global.asax file.

    If you want to know more about global.asax then refer below link

    Give respect to your work, Instead of trying to impress your boss.

    Blog :

  • #766365
    The Global.asax file, also known as the global application file, it is an optional file that contains code for responding to application-level events raised by ASP.NET or by HttpModules. The Global.asax file resides in the root directory of base application.
    MVC framework maps browser requests to controller actions and for that global.asax is important, here routes are defined in the Global.asax.cs file in a method called RegisterRoutes(..).
    a route table is created in the application's Global.asax file. The Global.asax file is a special file that contains event handlers for ASP.NET application lifecycle events. The route table is created during the Application Start event.

    Editor, DotNetSpider MVM
    Microsoft MVP 2014 [ASP.NET/IIS]

  • Sign In to post your comments