Go Premium for a chance to win a PS4. Enter to Win

x
?
Solved

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

Posted on 2008-10-31
3
Medium Priority
?
919 Views
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 -> http://www.dotnetjunkies.com/HowTo/91EA672F-C4C9-4235-B6C5-B20DEF7808A3.dcik but it does not work.  Code is copied below.
namespace InheritingHttpApplication 
{
   public class Global : System.Web.HttpApplication
   {
      public Global()
      {
         InitializeComponent();
      } 
      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

0
Comment
Question by:CipherIS
  • 2
3 Comments
 
LVL 16

Accepted Solution

by:
ororiole earned 2000 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.
0
 
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
0
 
LVL 16

Expert Comment

by:ororiole
ID: 22863305
ragi0017,
  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.
0

Featured Post

Hire Technology Freelancers with Gigs

Work with freelancers specializing in everything from database administration to programming, who have proven themselves as experts in their field. Hire the best, collaborate easily, pay securely, and get projects done right.

Question has a verified solution.

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

Exception Handling is in the core of any application that is able to dignify its name. In this article, I'll guide you through the process of writing a DRY (Don't Repeat Yourself) Exception Handling mechanism, using Aspect Oriented Programming.
In real business world data are crucial and sometimes data are shared among different information systems. Hence, an agreeable file transfer protocol need to be established.
Get people started with the utilization of class modules. Class modules can be a powerful tool in Microsoft Access. They allow you to create self-contained objects that encapsulate functionality. They can easily hide the complexity of a process from…
This lesson covers basic error handling code in Microsoft Excel using VBA. This is the first lesson in a 3-part series that uses code to loop through an Excel spreadsheet in VBA and then fix errors, taking advantage of error handling code. This l…
Suggested Courses

971 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