How do you put System.Web.HttpApplication in your app

Posted on 2008-10-31
Last Modified: 2011-10-03
I am trying to add System.Web.HttpApplication to my application.  Any idea how to do this.  I found an example for the Global.asax file but It will not build.  I tried following the directions here -> but it does not work.  Code is copied below.
namespace InheritingHttpApplication 
   public class Global : System.Web.HttpApplication
      public Global()
      protected void Application_Start(Object sender, EventArgs e)
      protected void Session_Start(Object sender, EventArgs e)
      protected void Session_End(Object sender, EventArgs e)
      protected void Application_End(Object sender, EventArgs e)

Open in new window

Question by:CipherIS
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
  • 2
LVL 16

Accepted Solution

ororiole earned 500 total points
ID: 22855549
What do you mean it does not build? Do you get a compiler error? What is the error?

Did you create a Global.asax file or just paste this code into a .cs file named something else? You need to add a Global.asax file to your project and use it. It will create the above file for you. You can then extend it like in his example but there needs to be a Global.asax file in your project if you want to do this.

You add a Global.asax file by selecting Add New Item, then select Global Application Class.
LVL 26

Expert Comment

by:Anurag Thakur
ID: 22856116
the example never mentioned it to be a global.asax class
he just mentioned that have you seen something like this and you can build something like that easily by inheriting from HttpApplication class

just add a normal class and inherit it from the HttpApplication class as shown by the sample
i tried it and its working as suggested
LVL 16

Expert Comment

ID: 22863305
  Please do not double post. You repeated the information the user already gave us. He said the example is not working for him. I gave a solution to get him up and running. It is true that this can be done without a global.asax file; however, if you had read the article you would see that the author does indeed refer to global.asax.

Featured Post

Free Tool: Port Scanner

Check which ports are open to the outside world. Helps make sure that your firewall rules are working as intended.

One of a set of tools we are providing to everyone as a way of saying thank you for being a part of the community.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

Suggested Solutions

Title # Comments Views Activity
What are MicroServices? 4 69
Concurrency Error Persistent using Data Grid View Update C# 2 32
Intermittent OleDbConnection Error 20 54
Example code 13 44
When trying to find the cause of a problem in VBA or VB6 it's often valuable to know what procedures were executed prior to the error. You can use the Call Stack for that but it is often inadequate because it may show procedures you aren't intereste…
Enums (shorthand for ‘enumerations’) are not often used by programmers but they can be quite valuable when they are.  What are they? An Enum is just a type of variable like a string or an Integer, but in this case one that you create that contains…
As developers, we are not limited to the functions provided by the VBA language. In addition, we can call the functions that are part of the Windows operating system. These functions are part of the Windows API (Application Programming Interface). U…
Get people started with the process of using Access VBA to control Excel using automation, Microsoft Access can control other applications. An example is the ability to programmatically talk to Excel. Using automation, an Access application can laun…

752 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question